The newline or line-feed character is denoted by ASCII code 0x0A (decimal 10). In C, we use the escape-sequence '\n' to denote a new line. In some cases, particularly where the output is directed to a line printer, a newline is immediately preceded by a carriage return character, 0x0D (13 decimal), which is denoted by the escape sequence '\r' in C. Thus you will often encounter the "\r\n" escape sequence at the end of each line of ASCII text.
Most commonly it's used to remove the newline character from the end of a string or an array of strings. If the newline character isn't there, then nothing is done to the string. There are other details involved in what chomp does, but mostly that is what it is used for. For instance you can change which character is considered the be the newline character. If you want to know more, I would suggest reading the documentation.
\x0a in unix, \x0d\x0a in Win/Dos
A newLine() method is provided, which uses the platform's own notion of line separator as defined by the system property line.separator. Not all platforms use the newline character ('\n') to terminate lines. Calling this method to terminate each output line is therefore preferred to writing a newline character directly, FileWriter doesn't have this feature. ALso BufferedWriter are fast as they write to buffer first before writing to file
Look at the "wc" command's man page, it will give you a count of all characters, including the newline character.
forward slash - division operator backward slash - special character (e.g. \n - newline) in C strings
Most commonly it's used to remove the newline character from the end of a string or an array of strings. If the newline character isn't there, then nothing is done to the string. There are other details involved in what chomp does, but mostly that is what it is used for. For instance you can change which character is considered the be the newline character. If you want to know more, I would suggest reading the documentation.
The newline or line-feed character is denoted by ASCII code 0x0A (decimal 10). In C, we use the escape-sequence '\n' to denote a new line. In some cases, particularly where the output is directed to a line printer, a newline is immediately preceded by a carriage return character, 0x0D (13 decimal), which is denoted by the escape sequence '\r' in C. Thus you will often encounter the "\r\n" escape sequence at the end of each line of ASCII text.
\x0a in unix, \x0d\x0a in Win/Dos
The end of line character on an IBM mainframe is the newline character (same as it is on Ascii platforms). The value, however, is different. It is a hex 0x25 (EBCDIC)
The newline character is used to mark the end of each line in Unix/Linux. Usually the character is specified as the '\n' character, which equates to a 0x0A character in Ascii based systems.
A newLine() method is provided, which uses the platform's own notion of line separator as defined by the system property line.separator. Not all platforms use the newline character ('\n') to terminate lines. Calling this method to terminate each output line is therefore preferred to writing a newline character directly, FileWriter doesn't have this feature. ALso BufferedWriter are fast as they write to buffer first before writing to file
Always. A newline is neither a space nor a tab.
A newline has ASCII character code 10, therefore you test for the integer value 10. That's not much use if the user needs to enter 10, therefore you should test the input before assigning the integer.
If you're using regular expressions, the character commonly used is a dot '.'. This will match any character except a newline. To match all characters including newlines would involve a statement, not a single character.
Look at the "wc" command's man page, it will give you a count of all characters, including the newline character.
forward slash - division operator backward slash - special character (e.g. \n - newline) in C strings
10 = 0AH