Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
shalu
- Posts: 72
- Joined: Fri Mar 20, 2015 1:05 pm
Post
by shalu » 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.

--
Thanks
Shalu S
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Thu Jun 25, 2015 8:22 am
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 mouseUp
-
shalu
- Posts: 72
- Joined: Fri Mar 20, 2015 1:05 pm
Post
by shalu » Thu Jun 25, 2015 10:42 am
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
-
Dixie
- Livecode Opensource Backer

- Posts: 1336
- Joined: Sun Jul 12, 2009 10:53 am
Post
by Dixie » Thu Jun 25, 2015 10:53 am
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 !!? ...
-
dunbarx
- VIP Livecode Opensource Backer

- Posts: 10331
- Joined: Wed May 06, 2009 2:28 pm
Post
by dunbarx » Thu Jun 25, 2015 2:10 pm
Without going too deeply into your handler, I think that:
Code: Select all
put "--" into ndash
put "----"into ndash
seems unlikely to help you. Maybe:
Code: Select all
put "--" into ndash
put "----"into nndash
Craig Newman
-
jacque
- VIP Livecode Opensource Backer

- Posts: 7393
- Joined: Sat Apr 08, 2006 8:31 pm
-
Contact:
Post
by jacque » Thu Jun 25, 2015 8:43 pm
I'd do this:
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
The characters between the quotes are the actual hyphen, ndash and mdash, though they look similar here in the post.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com