View previous topic :: View next topic |
Author |
Message |
Charbile
Joined: 02 Apr 2005 Posts: 106 Location: Blythewood
|
Posted: Sun Oct 11, 2009 2:32 pm Post subject: Strings - Special Characters |
|
|
How do you show the forward slash "\" or quotes in strings? Is there an escape character or some way to append it? |
|
Back to top |
|
|
Calehay ...yeah. Class B Minstrel
Joined: 07 Jul 2004 Posts: 549
|
Posted: Sun Oct 11, 2009 2:41 pm Post subject: |
|
|
You can use the append ascii command to do that:
Code: | append ascii (string ID, ascii char #) |
Replace "string ID" with ID of the string you want to add it to and replace "ascii char #" with the quotation or \'s ascii number. You'll find that number on the lower left of the Edit Font screen. _________________ Calehay |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Sun Oct 11, 2009 2:59 pm Post subject: |
|
|
That is a backslash. This one / is the forward slash.
Anyway, the backslash is the escape character.
For example:
Code: |
$0="\"Puppies and Kittens\""
show string(0)
|
will produce
Quote: | "Puppies and Kittens" |
And
Code: |
$0="C:\\OHRRPGCE\\"
show string(0)
|
will produce
|
|
Back to top |
|
|
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Mon Oct 12, 2009 7:34 am Post subject: |
|
|
Wait, are you saying that the backslash \ is the character used to say "treat my next symbol as an ascii, even if it is supposed to be reserved for something else"? I'm sorry, but I have no clue what "escape" character actually means. After trying to figure out your examples for a few minutes, my quote is the best I could come up with. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com |
|
Back to top |
|
|
Bob the Hamster OHRRPGCE Developer
Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Oct 12, 2009 9:53 am Post subject: |
|
|
Yes, that is a pretty great summary of what an escape character does.
There are a couple special cases where a backslash followed by a certain character can do something magical. In many programming languages, \n gets translated into ASCII 10 which is a newline. \t gets translated into a TAB and there are a few other common ones.
The OHRRPGCE doesn't support any of those magical "escape codes" in strings, but it probably will someday. Right now all the backslash is used for is to "protect" quotes (and other backslashes) |
|
Back to top |
|
|
|