문자열.length();문자열.toUpperCase(); -> 대문자문자열.toLowerCase(); -> 소문자문자열.contains("특정 문자열");s.contains("h"); -> hello면 true. Hello면 false.문자열.indexOf("특정 문자열"); -> 특정 문자열이 여러개일 때 맨 처음 발견되는 곳.lastIndexOf("특정 문자열"); -> 특정 문자열이 여러개일 때 마지막에 발견되는 곳문자열.startsWith("특정 문자열");문자열.endsWith("특정 문자열");문자열.replace("바꾸기 전 문자열", "바꾸려는 문자열");문자열.substring(위치값);String s = "Hello World Hello java";
System.out.println("6번째 문자열부터 : "s.substring(6));
-> World Hello java
System.out.println("6~11번째 문자열 : "s.substring(6, 11));
-> World문자열.split(특정 문자열)String s = "1234-5678";
System.out.println(s.split("-")[0]); -> 1234
System.out.println(s.split("-")[1]); -> 5678charAt(n) : n번째 문자 찾기char c = "123456-7891231".charAt(7); -> 7문자열.trim();String s = " Hello World "; -> 공백 5칸씩 글자 5글자씩. 총 25개 문자.
System.out.println(s.length()); -> 25
System.out.println("s : " + s.trim()); -> s : Hello World
System.out.println(s.trim().length()); -> 15문자열+문자열System.out.println("a" + " " + "b"); -> a b문자열.concat(결합할 문자열);System.out.println("a".concat(" ").concat("b")); -> a b문자열.equals(비교할 문자열)문자열.equalsIgnoreCase(비교할 문자열)