string_pos new line

N

NoFontNL

Guest
Is there a way to detect a new line in a string?

Thanks in advance.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Use chr(10) or chr(13) + chr(10) as needle, depending on your case ("\n" and "\r\n" if in GMS2)
 
N

NoFontNL

Guest
What is the difference between using only chr(10) and combining it with chr(13)?
 

CloseRange

Member
Someone correct me if I'm wrong because my memory is shaky
but chr(10) refers to line feed and chr(13) refers to return carriage.

I don't think it actually matters at least not for drawing text. It is possible it could screw up when saving strings to a file but when you are just drawing in game maker it won't make much difference.
It's just more of a common convention.
 
N

NoFontNL

Guest
I want to split strings in a text document. I found out about the string_split extension, but wasn't sure what to use for new line. Since I need the info in the file, I need to know which of the two I should use.
 
Top