JAVA
자바 toUpperCase, toLowerCase를 이용한 대소문자 변환
Berno
2020. 11. 12. 23:12
728x90
반응형
자바에서는 문자열 대소문자 변환에 대해 함수를 지원해줍니다.
toUpperCase()
javadoc에서 가장 첫 문장을 가져왔습니다.
Converts all of the characters in this String to upper case using the rules of the default locale.
String에 있는 모든 문자를 default locale의 규칙을 기반해 대문자로 변환해줍니다.
즉 모든 문자를 대문자로 바꿔준다는겁니다.
toUpperCase함수의 반환값은 String입니다. 사용법은 다음과 같습니다.
String testStr = "PeterJames";
String testStrUpperCase = testStr.toUpperCase();
testStrUpperCase에는 "PETERJAMES" 가 저장됩니다.
toLowerCase()
javadoc에서 가장 첫 문장을 가져왔습니다.
Converts all of the characters in this String to lower case using the rules of the default locale.
String에 있는 모든 문자를 default locale의 규칙을 기반해 소문자로 변환해줍니다.
즉 모든 문자를 소문자로 바꿔준다는겁니다.
toLowerCase함수의 반환값은 String입니다. 사용법은 다음과 같습니다.
String testStr = "PeterJames"
String testStrLowerCase = testStr.toLowerCase();
testStrLowerCase에는 "peterjames"가 저장됩니다.
728x90
반응형