Reputation: 2236
I have a string in a variable tLine.
Example
156 \zEntry lx ge ....
I would like to retrieve the substring starting with \zEntry.
Chapter 6.2.7 of the User's Guide is about Retrieving the Position of a Matching Chunk
So I do
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
I assume there are simpler ways to do this? How do they look like?
Upvotes: 0
Views: 365
Reputation: 756
Along the same lines that David posted...
get char offset("\zEntry",tLine) to the number of chars of tLine of tLine
The two close end references to "tLine" throw new users until they get used to it, though it makes sense. For example:
get char 3 to 20 of tLine --straightforward, with arbitrary values 3 and 20
and this is constructed as:
get char ("3"--start char derived from the offset) to ("20" --end char derived from the length of the string itself) of tLine
Upvotes: 2
Reputation: 436
Yes:
put char offset("\zEntry",tLine) to -1 of tLine into tSubstring
Upvotes: 4