Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何检索子字符串?_String_Substring_Livecode - Fatal编程技术网

String 如何检索子字符串?

String 如何检索子字符串?,string,substring,livecode,String,Substring,Livecode,变量行中有一个字符串 范例 156 \zEntry lx ge .... 我想检索以\zEntry开头的子字符串 《用户指南》的第6.2.7章是关于检索匹配块的位置的 我也是 get offset("\zEntry",tLine) put it into tCharStartPosition put the number of chars of tLine into tLength put char tCharStartPosition to tLength of tLine int

变量行中有一个字符串

范例

 156 \zEntry lx ge ....
我想检索以\zEntry开头的子字符串

《用户指南》的第6.2.7章是关于检索匹配块的位置的

我也是

 get offset("\zEntry",tLine)
 put it into tCharStartPosition
 put the number of chars of tLine into tLength
 put char tCharStartPosition to tLength of tLine into tResultingSubstring
我想有更简单的方法吗?它们看起来怎么样?

是的:

put char offset("\zEntry",tLine) to -1 of tLine into tSubstring
是的:


按照David发布的内容

获取字符偏移量(“\zEntry”,tLine)到tLine的tLine的字符数

对“tLine”的两个近端引用会让新用户习惯它,尽管这很有意义。例如:

获取tLine的char 3到20——简单明了,具有任意值3和20

其结构如下:


按照David发布的同一行,从tLine的get char(“3”--从偏移量派生的起始字符)到(“20”--从字符串本身的长度派生的结束字符)

获取字符偏移量(“\zEntry”,tLine)到tLine的tLine的字符数

对“tLine”的两个近端引用会让新用户习惯它,尽管这很有意义。例如:

获取tLine的char 3到20——简单明了,具有任意值3和20

其结构如下:

获取tLine的字符(从偏移量派生的起始字符)到(从字符串本身的长度派生的结束字符)