Home AMX Forum NetLinx Studio
Options

How do I put a ' (apostrophe) inside a string of text?

KmclaneKmclane Junior Member
I can't believe I have never run into this before, but how do you create a string of text that has an apostrophe within the string?
I am trying to send text (using constants to store the text) to an LED readerboard and think I remember there being a special character sequence that allows that.

Comments

  • a_riot42a_riot42 AMX Wizard
    Kmclane wrote: »
    I can't believe I have never run into this before, but how do you create a string of text that has an apostrophe within the string?
    I am trying to send text (using constants to store the text) to an LED readerboard and think I remember there being a special character sequence that allows that.

    You can't.


    Just kidding. Its its own escape character, similar to back slashes in other languages. Type the apostrophe twice to make it nice.
    Paul
  • KmclaneKmclane Junior Member
    Thanks!
    Digging feverishly through all of my old manuals and guides and couldn't (or should I say ouldn''t) find anything.
    I suspected that was the solution, but then thought it would interpret as two text segments, right next to each other. Don't know why I just didn't compile and test.
  • ColzieColzie Senior Member
    Wow, thanks Paul! I always used hex 27, but your way is much cleaner.
    "'Ben', $27, 's Rm'"
    
    "'Ben''s Rm'"
    
  • ericmedleyericmedley Senior Member - 3709 Posts
    Colzie wrote: »
    Wow, thanks Paul! I always used hex 27, but your way is much cleaner.
    "'Ben', $27, 's Rm'"
    
    "'Ben''s Rm'"
    

    Ha! I did this same thing too up until about 3 years ago. I still run into old code where I found I did this.
  • a_riot42a_riot42 AMX Wizard
    Colzie wrote: »
    Wow, thanks Paul! I always used hex 27, but your way is much cleaner.
    "'Ben', $27, 's Rm'"
    
    "'Ben''s Rm'"
    

    I haven't seen the escape characters documented anywhere, so we are left to our own devices. I'm sure this stumps everyone the first time.
    Paul
  • GSLogicGSLogic Junior Member
    Just to be a smart but - I've always used:
    "'Ben', 39, 's Rm'"
    You can also use this for temp degrees °
    

    :)
  • jjamesjjames AMX Sustaining Engineer
    There's Gary again - always wanting to be different! :D

    I do the double apostrophe as well.
Sign In or Register to comment.