PRACTICE/JAVA

[프로그래머스] 특정한 문자를 대문자로 바꾸기

j1ngerhead 2025. 2. 23. 00:55

 

문제 링크

https://school.programmers.co.kr/learn/courses/30/lessons/181873

class Solution {
    public String solution(String my_string, String alp) {

        return my_string.replace(alp,alp.toUpperCase());
    }
}

 

문자열 치환 + 대문자 변경

replace 메서드 toUpperCase 메서드를 사용했다.

320x100