Lua中将字符串中的所有字符变成小写
事情是这样的。我试图在 Lua 中将字符串转换为小写,但它不起作用。我已经这样做了,
String = String:lower()
但它不喜欢它。我确信这就是这样做的方法,我以前见过这样做的。一些网站表明这可能是由错误版本的解释器引起的问题。
有什么想法吗?
Here is the thing. I am trying to convert a string in lowercase in Lua, but it's not working. I have done this
String = String:lower()
but it doesn't like it. I am sure that is the way to do it, I've seen it done before. A few sites suggest it might be a problem caused by a wrong version of the interpreter.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你是对的,这是实现这一目标的方法之一。如果您的“String”变量不是字符串,它只会不起作用并抛出错误。
就我个人而言,我通常更喜欢使用类似的东西。
一样的
但是,它实际上与假设 myString 实际上是一个字符串是
。 “长”版本有一个优点,如果 myString 是数字,它实际上可以工作,而在这种情况下第二个版本会出错。
You're right, this is one of the ways to do it. It would only not work and throw errors if your "String" variable is not a string.
Personally, i usually prefer to use something like..
But its really the same as doing
assuming that myString is actually a string, however.
The "long" version has one advantage, it actually works if myString is a number, while the second one errors in that case.