toLowerCase(): 문자열을 소문자로 만들어 준다
toUpperCase(): 문자열을 대문자로 만들어 준다
package com.test;
public class test {
public static void main(String[] args) {
String str = " hELlo WOrlD";
String lowStr = str.toLowerCase();
String upStr = str.toUpperCase();
System.out.println(lowStr);
System.out.println(upStr);
}
}
// 결과
// hello world
// HELLO WORLD
'Java > java 메소드' 카테고리의 다른 글
replaceAll() - 문자열의 문자를 바꾸고 싶을 때 (0) | 2022.10.27 |
---|---|
Math.sqrt() - 자바 루트 구하기 (1) | 2022.10.11 |
split() - 문자를 기준으로 문자열 자르기 (0) | 2022.10.07 |
Integer.toString() <-> Integer.parseInt() - 정수를 문자열로, 문자열을 정수로 (1) | 2022.10.07 |
sort() - 배열 오름차순, 내림차순 정렬 (0) | 2022.10.06 |