下载此文档

lua脚本中string库用法整理(Usage of string Library in Lua script).doc


文档分类:IT计算机 | 页数:约13页 举报非法文档有奖
1/13
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/13 下载此文档
文档列表 文档介绍
lua脚本中string库用法整理(Usage of string Library in Lua script)
The 10:39 2007-5-1110:39 2007-5-11 bare Lua interpreter has limited functionality for manipulating strings. A program can create strings and connect strings, but can not intercept substring, check the size of the string, detect the content of the string. In Lua, the function of manipulating strings es from the string library.
Some of the functions in String is very simple: (s) returns a string length of S; (s, n) to repeat n times s string string; you use (a, 2^20) string can create a 1M bytes (for example, in order to test the required); (s) in the s will be converted to lowercase uppercase letters ( lowercase to uppercase). If you want to sort out an array without caring about the size, you can do that:
(a, function (a, b))
Return (a) < (b)
End)
Both and depend on local environment variables. So, if you're in the European Latin-1 environment, the expression:
("a?? o")
Return results: "A?? O"
Call the (s, I, J) function to intercept the string s from I characters to J characters. In Lua, the first character index of a string starts from 1. You can also use negative indexes, and negative indexes count forward from the end of the string: -1 points to the last character, -2 points to the last second, and so on. Therefore, (s, 1, J) returns the prefix length s of the string J, and (s, J, -1) returns the suffix starting from the J character. If the third parameter is not provided, the default is -1, so we write the last call to (s, J); (s, 2, -2) returns the substring that removes the first and last characters.
(s, n) - means: get the character from N in S.
S = "[in brackets]""
Print ( (s, 2, -2)) - > in brackets
Remember: the strings in Lua are immutable. The function and other strin

lua脚本中string库用法整理(Usage of string Library in Lua script) 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数13
  • 收藏数0 收藏
  • 顶次数0
  • 上传人rjmy2261
  • 文件大小25 KB
  • 时间2017-11-22