NetTalk Central

Author Topic: Translate '<10><13>' to '<br/>'  (Read 2552 times)

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Translate '<10><13>' to '<br/>'
« on: March 24, 2014, 01:17:52 PM »
Hi

Best way?

REgards Niels

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Translate '<10><13>' to '<br/>'
« Reply #1 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 *
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Translate '<10><13>' to '<br/>'
« Reply #2 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.

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Re: Translate '<10><13>' to '<br/>'
« Reply #3 on: March 25, 2014, 01:20:40 AM »
Nice tool :-)

Thanks

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Translate '<10><13>' to '<br/>'
« Reply #4 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>'))
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Translate '<10><13>' to '<br/>'
« Reply #5 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


Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Translate '<10><13>' to '<br/>'
« Reply #6 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.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Translate '<10><13>' to '<br/>'
« Reply #7 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?
« Last Edit: March 26, 2014, 01:23:52 AM by Bruce »

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Translate '<10><13>' to '<br/>'
« Reply #8 on: March 26, 2014, 12:59:42 AM »
Hey! Take that back!

NEVER AN "EX" PROP!
Cheers,

Stu Andrews