cut a part out of a text...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
aerypton
Posts: 4
Joined: Wed Dec 09, 2009 5:43 pm

cut a part out of a text...

Post by aerypton » Wed Dec 09, 2009 6:07 pm

I want to cut a part out of a text.
For example: I need the part between "," and " and" from "This is a test, a second test and a third test."

In php there is something like "substr" and "strstr".
But is there a function in Revolution that does what I want?
I have been search the red in my eyes... But I didn't find it.

Can anyone help me?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: cut a part out of a text...

Post by dunbarx » Wed Dec 09, 2009 6:27 pm

Easy, you just need to cut up text the way you like. Is the example you posted typical of what you always will be dealing with? The following script assumes this:

Code: Select all

on mouseup
   put item 2 of  yourData into yourString
   answer char 1 to  offset("and",yourString)  + 3 of yourString --did you want the "and"?
   answer char 1 to  offset("and", yourString) - 1 of  yourString -- or not
end mouseup
This can be extended and generalized once you get the idea.

aerypton
Posts: 4
Joined: Wed Dec 09, 2009 5:43 pm

Re: cut a part out of a text...

Post by aerypton » Wed Dec 09, 2009 8:39 pm

phoe... it is so easy that I didn't found it... :roll: :D
Thanx

Post Reply