Endline Character

BlitzMax Forums/BlitzMax Programming/Endline Character

Black Hydra(Posted 2006) [#1]
I'm having some difficulty using the endline character "~n" in my code.

It seems when I type out the character as a constant as in:

Txt = "This would be line one~nThis would be line two."

It works fine.

However, whenever I try to use a string that was loaded from a file containing the "~n" character, it prints the "~n" character literally to the screen instead.

Is this because the BlitzMax compiler somehow substitutes the ~n for endline characters when compiling?

I have tried using the following code to manually replace the "~n" with Chr(10), however the Replace() function doesn't seem to replace any of the characters at all...

Data = Replace(Data, "~n", Chr(10))
Info = Replace(Info, "~n", Chr(10))

Any help solving this mystery would be greatly appreciated.


Chris C(Posted 2006) [#2]
probably need Data = Replace(Data, "~~n", Chr(10))

to escape the ~

you were replacing chr 10 with chr 10


Black Hydra(Posted 2006) [#3]
That works fine now, thanks for that!