Select a word from end of the line
Posted: Thu Jun 25, 2015 8:00 am
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.



Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
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 mouseUp
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
Code: Select all
put "--" into ndash
put "----"into ndash
Code: Select all
put "--" into ndash
put "----"into nndash
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 selectedtext1