코딩테스트/[C#] 프로그래머스
[프로그래머스 | C# | Lv.0] 공백으로 구분하기 2
냠냠쿠
2023. 10. 2. 17:21
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/181868
📝 나의 풀이
using System;
using System.Collections.Generic;
using System.Linq;
public class Solution {
public string[] solution(string my_string) {
string[] answer = my_string.Trim().Split(" ");
answer = answer.Where(x => !string.IsNullOrEmpty(x)).ToArray();
return answer;
}
}
728x90