• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code string_escape ??

xDGameStudios

GameMaker Staff
GameMaker Dev.
is there a way to escape all characters in a string. I know that using

Code:
@"string \n with \t escape characters"
but what if I have string in a variable read from a file...

var input;

and want to escape all the characters?
 

gnysek

Member
I think, that if you read '\n' from a file, then it will display as \n, as it's 92+110, not 10 in ASCII (UTF8 first 128 letters are probably same). Text file need to have real newline to read it as what GM would format when writing "\n" in code.
 

xDGameStudios

GameMaker Staff
GameMaker Dev.
I think, that if you read '\n' from a file, then it will display as \n, as it's 92+110, not 10 in ASCII (UTF8 first 128 letters are probably same). Text file need to have real newline to read it as what GM would format when writing "\n" in code.
You are saying that reading from a file... they are already escaped? Great thank you ;) that was helpful
 

gnysek

Member
In fact they don't need to be escaped, as they are readed as already parsed string (like after game is compiled).
 
Top