Line feed '\n' and carriage return '\r' and ASCII code table

Line feed '\n' and carriage return '\r'

As the name suggests, the newline character is to start a new line, and the carriage return character is to return to the beginning of a line, so the carriage return character we usually write in the file should be exactly called the carriage return line feed character.  

'\n' 10 newline (newline)
'\r' 13 carriage return (return)


It can also be expressed as '\x0a' and '\x0d'. (hexadecimal)

Under the Windows system, the carriage return and line feed symbol is "\r\n". But under Linux and other systems, there is no "\r" symbol.

When parsing the content of files in text or other formats, it is often necessary to judge the carriage return and line feed. At this time, it is necessary to pay attention to judge both "\r\n" and "\n".

When writing a program, you may get a line, trim it with '\r', so that you can get the string you need.

 

My experiment: The carriage return entered under VC2005 is only '\n'; very good, it is unified with Linux

 

ASCII code comparison table

The following table lists 0 - 127 in the character set.

 

code character code character code character code character
0   32 [space] 64 @ 96 `
1   33 ! 65 A 97 a
2   34 " 66 B 98 b
3   35 # 67 C 99 c
4   36 $ 68 D 100 d
5   37 % 69 E 101 e
6   38 & 70 F 102 f
7   39 ' 71 G 103 g
8 ** 40 ( 72 H 104 h
9 ** 41 ) 73 I 105 i
10 ** 42 * 74 J 106 j
11   43 + 75 K 107 k
12   44 , 76 L 108 l
13 ** 45 - 77 M 109 m
14   46 . 78 N 110 n
15  47 / 79 O 111 O
16  48 0 80 P 112 p
17  49 1 81 Q 113 q
18  50 2 82 R 114 r
19   51 3 83 S 115 s
20   52 4 84 T 116 t
21   53 5 85 U 117 u
22  54 6 86 V 118 v
23  55 7 87 W 119 w
24  56 8 88 X 120 x
25  57 9 89 AND 121 and
26  58 : 90 WITH 122 with
27

 

http://ascii.911cha.com/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325158526&siteId=291194637