string:len("abcdef"). | 结果为 6 | 求字符串的长度 |
string:equal("abc","abc"). | 结果为 true | 判断2字符串是否完全相等 |
string:concat("abc","def"). | 结果为 "abcdef" | 合并字符串 |
string:chr("abdcdef",$d). | 结果为 3 | 求某一字符在字符串中第一次出现的位置 |
string:rchr("abdcdef",$d). | 结果为 5 | |
string:str("hehe haha haha","haha"). | 结果为 6 | 求某一字符串在字符串中第一次出现的位置 |
string:rstr("hehe haha haha","haha"). | 结果为 11 | |
string:substr("Hello World",4). | 结果为 "lo World" | 截取字符串 |
string:substr("Hello World",4,5). | 结果为 "lo Wo" | 截取字符串 |
string:tokens("asdhfgjjdttfg","df"). | 结果为 ["as","h","gjj","tt","g"] | 分割字符串 |
string:join(["aaa","bbb","ccc"],"@"). | 结果为 "aaa@bbb@ccc" | 用特定字符连接 |
string:chars($a,5). | 结果为 "aaaaa" | |
string:copies("as",5). | 结果为 "asasasasas" | |
string:words("aaa bbb ccc"). | 结果为 3 | |
string:words("abcbchdbjfb",$b). | 结果为 4 | 用字符b分割,求个数 |
string:sub_words("abcbchdbjfb",3,$b). | 结果为 "chd" | 用字符b分割,取第三个 |
string:strip(" aaa "). | 结果为 "aaa" | 去掉字符串两边的空格 |
string:strip("...aaa..",both,$.). | 结果为 "aaa" | 去掉字符串两边的. |
string:left("hahaha",10). | 结果为 "hahaha " | 截取前10个字符串,不足用空格补(string:right类似)(string:centre类似) |
string:left("hahaha",10,$!). | 结果为 "hahaha!!!!" | 截取前10个字符串,不足用!补(string:right类似)(string:centre类似) |
string:to_integer("123sa23"). | 结果为 {123,"sa23"} | |
srring:to_lower("asFDds"). | 结果为 "asfdds" | 转换小写 |
srring:to_upper("asFDds"). | 结果为 "ASFDDS" | 转换大写 |
转自:http://abin888.blog.sohu.com/236274578.html