-
728x90
- 문자열 길이
String txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; System.out.println("The length of the txt string is: " + txt.length()); :: The length of the txt string is: 26
- 대소문자 변환
String txt = "Hello World"; System.out.println(txt.toUpperCase()); System.out.println(txt.toLowerCase()); :: HELLO WORLD :: hello world
- 문자열 찾기
String txt = "Please locate where 'locate' occurs!"; System.out.println(txt.indexOf("locate")); :: 7
- 문자열 연결
String firstName = "John"; String lastName = "Doe"; System.out.println(firstName + " " + lastName); :: John Doe
String firstName = "John "; String lastName = "Doe"; System.out.println(firstName.concat(lastName :: John Doe
- 특수문자
String txt = "We are the so-called \"Vikings\" from the north."; System.out.println(txt); :: We are the so-called "Vikings" from the north.
String txt = "It\'s alright."; System.out.println(txt); :: It's alright.
String txt = "The character \\ is called backslash."; System.out.println(txt); :: The character \ is called backslash.
'개발' 카테고리의 다른 글
Flutter 환경설정 1 (0) 2022.03.12 input file 미리보기 이미지 (0) 2022.01.28 postman 팀원초대 (0) 2022.01.27 table ...말줄임 (0) 2022.01.26 부트스트랩 모달 콜백이벤트 추가 (0) 2022.01.26