CharOffset |
Type | operator |
Dictionary | LCB |
Library | LiveCode Builder |
Syntax | the ( first | last ) offset of <Needle> in <Target>
|
Associations | com.livecode.char |
Summary | Finds the first or last occurrence of Needle within Target
|
Parameters | Name | Type | Description |
---|
Needle | | An expression which evaluates to a string.
|
Target | | An expression which evaluates to a string.
|
|
Example | variable tVar as Number
put the first offset of "art" in "cartoon" into tVar
variable tVar as Number
variable tFilePath as String
put "/Users/user/Documents/file.txt" into tFilePath
put the last offset of "/" in tFilePath into tVar
variable tFileName as String
put char 1 to tVar of tFilePath into tFileName
|
Values | Name | Type | Description |
---|
return | | Returns the offset of Needle in Target.
|
|
Description | The first (respectively last) offset of Needle in Target is number of chars between the first char of Target and the first (respectively last) occurrence of Needle. If neither first or last is specified, then the first offset is found. If Needle does not occur in Target, then the output is 0.
|
Tags | strings |