NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Niels Larsen on March 24, 2014, 01:17:52 PM

Title: Translate '<10><13>' to '<br/>'
Post by: Niels Larsen on March 24, 2014, 01:17:52 PM
Hi

Best way?

REgards Niels
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Stu on March 24, 2014, 01:22:05 PM
Hi Niels,

Not sure if this is what you are asking, but ..

When I have text that has '<13,10>' in it, and I need to make it "html-nice", I use a StringTheory object to do the search and replace.

IE

Code: [Select]
st.Replace('<13,10>','<br/>',,,,,1)     !* the "1" being for the Recursive parameter *
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Bruce on March 24, 2014, 08:28:02 PM
Br does no occur inside <13,10> hence recursion is not required.  Stu, you are confusing recursion with just repeating -which is only limited by the count, start and end parameters.
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Niels Larsen on March 25, 2014, 01:20:40 AM
Nice tool :-)

Thanks
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Stu on March 25, 2014, 06:33:20 PM
My apologies Bruce.

It should read:

Code: [Select]
st.Replace('<13,10>','<br/>',st.Count('<13,10>'))
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Bruce on March 25, 2014, 09:31:50 PM
Hi Stu,

According to the docs at
http://www.capesoft.com/docs/StringTheory/StringTheory.htm#stReplace
the count parameter is optional.

so
st.Replace('<13,10>','<br/>',st.Count('<13,10>'))

becomes
st.Replace('<13,10>','<br/>')

which kinda just does what it says on the tin - replaces <13,10> with <br/>

Cheers
Bruce

Title: Re: Translate '<10><13>' to '<br/>'
Post by: Stu on March 26, 2014, 12:10:29 AM
Doh.

Just logged on here to say that I just discovered this, but you beat me to the punch.

I'm still living back when I thought you needed to specific how many times you had to replace.

New thing learned again because you told me this last year some time.
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Bruce on March 26, 2014, 12:12:30 AM
yeah well, you know Australians.... and props... so imagine what it's like dealing with an ex-prop who's also Australian?
Title: Re: Translate '<10><13>' to '<br/>'
Post by: Stu on March 26, 2014, 12:59:42 AM
Hey! Take that back!

NEVER AN "EX" PROP!