본문 바로가기
Java 배우기

Summary of Characters and Strings 글자와 문자열 요약

by 노화방지 Anti-aging Hairstyle 2016. 1. 5.
반응형
String s = "Hello world!";

rather than using one of the String constructors.


The String class has many methods to find and retrieve substrings; these can then be easily reassembled into new strings using the + concatenation operator.

The String class also includes a number of utility methods, among them split()toLowerCase()toUpperCase(), and valueOf(). The latter method is indispensable in converting user input strings to numbers. The Number subclasses also have methods for converting strings to numbers and vice versa.

In addition to the String class, there is also a StringBuilder class. Working with StringBuilder objects can sometimes be more efficient than working with strings. The StringBuilder class offers a few methods that can be useful for strings, among them reverse(). In general, however, the String class has a wider variety of methods.

A string can be converted to a string builder using a StringBuilder constructor. A string builder can be converted to a string with the toString() method.



반응형

댓글