How to get lines from braces.

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

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: How to get lines from braces.

Post by Thierry » Fri Oct 16, 2015 7:11 am

samjith wrote:Hi,

I apologize for my words :( .
Fair enough, thanks.

But i didn't wite a single example like this in the field, i think that may confused Thierry
Mmm, I wasn't confused, I did write a piece of code to deal with the precise
dataSet you put in your stack sample, nothing more.

What's confusing, is that you didn't provide this extra data (nested markers)
in your dataSet.


Anyway, you are a lucky man that James came out with a nice solution for you :)

Enjoy your day!

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 489
Joined: Thu Sep 04, 2008 6:23 am

Re: How to get lines from braces.

Post by jameshale » Fri Oct 16, 2015 8:42 am

if this is the case then yes, my "walking" method will work.
However you need to work out what to do with the <return> characters (line feeds) that are in your original example.
Are they really present in the text you will process?
The example you gave in your original post only required the <returns> to be deleted (removed) as the end of each line was actually <space><return>.
If you run a...

Code: Select all

replace return with space in TheText
You will end up with double spaces!
If you do not know what will be there you could try

Code: Select all

replace return with space in TheText
replace "  " with " " in TheText
This means though that the resulting transformed text will be all on one line!
If you look at the text you want processing you may see there are double line breaks that you want to keep.
If this is the case you need to conserve those.
One way to do this would be

Code: Select all

replace return&return with "******" in TheText --preserve dble return breaks
replace return with space in TheText--get rid of the single returns
replace "  " with " " in TheText--collapse dble spaces to single
replace "******" with return in TheText--restore the dble breaks as a single break
The above four replace statements can also be done using regex.
Might be faster. The principle is the same.

All this is a long winded way of say you need to do this before using my routine.

James

samjith
Posts: 85
Joined: Tue Mar 31, 2015 10:09 am

Re: How to get lines from braces.

Post by samjith » Fri Oct 16, 2015 8:58 am

Thank you gurus :D.

Post Reply