[프로그래머스]공백으로 구분하기 2

박예림·2023년 6월 8일
0

코테

목록 보기
132/132

class Solution {
    public String[] solution(String my_string) {
        return my_string.trim().split("[ ]+");
    }
}

//정규 표현식을 사용해 공백 한 칸 제거
String[] arStr = "eoeo eoeo".split("\\s");

//정규 표현식을 사용해 가변적인 공백을 제거
String[] arStr = "aeoeo      eoeo".split("\\s+");
profile
응애 나 아기개발자

0개의 댓글

Powered by GraphCDN, the GraphQL CDN