Just to add to the discussion. Brent is right, newline’s only get processed on multi-line text’s, so a single line text \n has no meaning.
And FWIW, OS-X and iOS are built on a Unix based operating system that uses the MACH Kernel. Android us a unix like operating system running on the Linux kernel. All “Unix” based operating systems use \n as the new line character.
In the old day of OS 9 and before, Apple ran on their own operating system. Their OS uses a CTRL-M (ASCII 13) or CR (Carriage Return) character for their newline separator. This is coded as \r. The \n for reference is the Linefeed character or CTRL-J or ASCII 10 depending on your point of view. Windows and it’s MS-DOS history uses a combination of CR and LF to end their lines, so on Window’s its \r\n in many cases. If you try to look at Windows files on a Unix box, you typically see a ^M at the end of each line because Unix used the ^J as it’s newline. Now Corona SDK on Windows is built using a more Unix like library, so the \n should work just fine on the Windows simulator too.
I had similar problem with iOS. These are things I noticed. On windows and on android device ‘/n’ character works with single line text. However when I build for IOs then it didn’t work - had to make text multiline.
@amir_go04, if you want to use a newline (\n) and have the text end up on two separate lines without the \n showing up, you MUST use must provide a width to display.newText to put it in multi-line mode.
Just to add to the discussion. Brent is right, newline’s only get processed on multi-line text’s, so a single line text \n has no meaning.
And FWIW, OS-X and iOS are built on a Unix based operating system that uses the MACH Kernel. Android us a unix like operating system running on the Linux kernel. All “Unix” based operating systems use \n as the new line character.
In the old day of OS 9 and before, Apple ran on their own operating system. Their OS uses a CTRL-M (ASCII 13) or CR (Carriage Return) character for their newline separator. This is coded as \r. The \n for reference is the Linefeed character or CTRL-J or ASCII 10 depending on your point of view. Windows and it’s MS-DOS history uses a combination of CR and LF to end their lines, so on Window’s its \r\n in many cases. If you try to look at Windows files on a Unix box, you typically see a ^M at the end of each line because Unix used the ^J as it’s newline. Now Corona SDK on Windows is built using a more Unix like library, so the \n should work just fine on the Windows simulator too.
I had similar problem with iOS. These are things I noticed. On windows and on android device ‘/n’ character works with single line text. However when I build for IOs then it didn’t work - had to make text multiline.
@amir_go04, if you want to use a newline (\n) and have the text end up on two separate lines without the \n showing up, you MUST use must provide a width to display.newText to put it in multi-line mode.