NetTalk Central

Author Topic: Generating script strings with StringTheory  (Read 5016 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Generating script strings with StringTheory
« on: November 30, 2015, 03:56:30 PM »
Hi, Bruce
Pretty sure I know that answer to this question but if I am wrong it will save a lot of work and potential bugs so here goes:
Is there a way to take the standard text you might find in a Javascript and double up or replace with ascii numbers all the < { ' characters using StringTheory.  Replacing < and { are easy, but I don't see any way to deal with single quotes.  For some reason, I thought I saw it in your session on StringTheory on ClarionLive, but couldn't find it when I reviewed the session. Thanks.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Generating script strings with StringTheory
« Reply #1 on: November 30, 2015, 08:02:27 PM »
check out QUOTE in the clarion docs - it might be all you need.

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Generating script strings with StringTheory
« Reply #2 on: December 01, 2015, 11:00:13 AM »
Thanks, Kevin.  At a loss as why I never noticed it before.

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Generating script strings with StringTheory
« Reply #3 on: December 01, 2015, 02:32:55 PM »
Thanks again, Kevin, but the Clarion Language QUOTE does not handle single quotes despite the documentation.  QUOTE in the Template Language does though.

QUOTE( ' Test ' < {  Characters ' ),0) will yield the same compiler errors as MESSAGE( ' Test ' << {{ ')

Looks like a CODE template for building script strings is in order   

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Generating script strings with StringTheory
« Reply #4 on: December 01, 2015, 03:59:56 PM »
Correct - to use Quote you need to start with a valid string in the clarion language. Sounds like your code template might have potential.





CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Generating script strings with StringTheory
« Reply #5 on: December 01, 2015, 05:33:50 PM »
For anyone with the same problem, this code template will take your source text, convert it to a qualified Clarion string and append it to the packet.  Watch the line break on first line.

#CODE(ClarionString,'Packet Clarion String from Input'),DESCRIPTION('Packet Clarion String: '&%DescriptionText)
#!Double ups ' { < and appends to packet
#DECLARE(%ModifiedText)
#PROMPT('Text to append:',TEXT),%InputText
#DISPLAY('No start and end quotes')
#PROMPT('Description:',@s255),%DescriptionText
#SET(%ModifiedText,QUOTE(%InputText))
packet.append('%ModifiedText')