77. 특정한 문자를 대문자로 바꾸기

김해준's avatar
Dec 12, 2025
77. 특정한 문자를 대문자로 바꾸기

사용언어 : Java

문제
notion image
풀이
class Solution { public String solution(String my_string, String alp) { String answer = ""; String upper = alp.toUpperCase(); answer = my_string.replace(alp,upper); return answer; } }
notion image
해당 문제는 두개의 메서드를 사용하여 처리하였다
toUpperCase를 사용하여 변경할 소문자를 대문자로 설정하였고
replace를 통해 alp라는 소문자를 upper라는 대문자로 교체하였다
Share article