I had always used find and foundline, but only in Text fields, but what about finding the line in a variables?
If my variable x has
A
B
C
D
E
how do I find the line where "C' is located in the variable "x"?
Scott
the line number in a variable
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: the line number in a variable
Hi Scott,
What about this:
Best regards
Jean-Marc
What about this:
Code: Select all
put "A,B,C,D,E" & cr into x
replace "," with cr in x
put lineoffset(C & cr,x)
Jean-Marc
https://alternatic.ch
-
- VIP Livecode Opensource Backer
- Posts: 153
- Joined: Thu Jun 29, 2006 4:16 pm
Re: the line number in a variable
You could try:
local tVariableWithLines
repeat with x = 1 to the number of lines in tVariableWithLines
if line x of tVariableWithLines = "C" then
answer x
end if
end repeat
be well,
randy
local tVariableWithLines
repeat with x = 1 to the number of lines in tVariableWithLines
if line x of tVariableWithLines = "C" then
answer x
end if
end repeat
be well,
randy