Difference between revisions of "Special Character"
Jump to navigation
Jump to search
(New page: {{String Functions}} <question> You can build a string using format. The % values are substituted. <shell> public class P{ public static void main(String[] argv) ...) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{String Functions}} | {{String Functions}} | ||
− | <question> | + | <question>Some characters must be escaped in string literals: |
− | + | Backslash \\ | |
+ | New line \n | ||
+ | Quote \" | ||
+ | Tab \t | ||
<shell> | <shell> | ||
public class P{ | public class P{ | ||
Line 9: | Line 12: | ||
}} | }} | ||
</shell> | </shell> | ||
− | <prog>String s = "Tab\ | + | <prog>String s = "Tab\tQuote \"New line\n Back-slash\\\\"; |
System.out.println(s); | System.out.println(s); | ||
</prog> | </prog> | ||
</question> | </question> |
Latest revision as of 19:20, 13 January 2008
Some characters must be escaped in string literals:
Backslash \\ New line \n Quote \" Tab \t
[Font]
[Default]
[Show]
[Resize]
[History]
[Profile]