Home AMX User Forum NetLinx Studio

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

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 Posts: 1,624
    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 Posts: 33
    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 Posts: 470
    Wow, thanks Paul! I always used hex 27, but your way is much cleaner.
    "'Ben', $27, 's Rm'"
    
    "'Ben''s Rm'"
    
  • ericmedleyericmedley Posts: 4,177
    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 Posts: 1,624
    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 Posts: 562
    Just to be a smart but - I've always used:
    "'Ben', 39, 's Rm'"
    You can also use this for temp degrees °
    

    :)
  • jjamesjjames Posts: 2,908
    There's Gary again - always wanting to be different! :D

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