Select a word from end of the line
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Select a word from end of the line
I am beginner in Livecode, I am looking for the code of select the word from end of the line and when it's find comma then selected content is assigned to a variable.

--
Thanks
Shalu S
Thanks
Shalu S
Re: Select a word from end of the line
I think this is what you want to do...
Code: Select all
on mouseUp
put "The clouds are moving quickly across the sky" into theWords
put the last word of theWords & comma after theData
put theData
end mouseUpRe: Select a word from end of the line
it's not working, my requirement, I have a Scrolling field containing text (eg: ss1-ss CR sd--sd CR sss---dsd) here CR means ss1-ss e.t.c are separate lines. I want separate these words and store words in separate variable. I am using the following code, it's only work first condition (ss1-ss) but it's not working in sd--sd (here separated by ndash) also sss---dsd (mdash).
Code: Select all
command selectedtext1
put the selectedText into selectvari
put "-" into dash
put "--" into ndash
put "----"into ndash
if selectvari contains dash then
split selectvari by dash
put selectvari[1] into newvari1
put selectvari[2] into newvari2
answer newvari1
answer newvari2
else if selectvari contains ndash then
split selectvari by ndash
put selectvari[1] into newvari3
put selectvari[2] into newvari4
answer newvari3
answer newvari4
else if selectvari contains mdash then
split selectvari by mdash
put selectvari[1] into newvari5
put selectvari[2] into newvari6
answer newvari5
answer newvari6
else
beep
end if
end selectedtext1
--
Thanks
Shalu S
Thanks
Shalu S
Re: Select a word from end of the line
Why did you not explain your problem at length, as you have attempted to do in your second post, when you first created the thread !!? ...
Re: Select a word from end of the line
Without going too deeply into your handler, I think that:
seems unlikely to help you. Maybe:
Craig Newman
Code: Select all
put "--" into ndash
put "----"into ndash Code: Select all
put "--" into ndash
put "----"into nndash Re: Select a word from end of the line
I'd do this:
The characters between the quotes are the actual hyphen, ndash and mdash, though they look similar here in the post.
Code: Select all
command selectedtext1
put the selectedText into selectvari
repeat for each item i in "-,–,-"
if selectvari contains i then
set the itemdel to i
put item 1 of selectvari into newvari1
put item 2 of selectvari into newvari2
answer newvari1
answer newvari2
exit selectedtext1
end if
end repeat
beep
end selectedtext1Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com

