let someString = " 공백 " let trimString = someString.trimmingCharacters(in: .whitespaces) print(trmString) //"공백" //다른 방법 var someString = " 공백 " let trimString = someString.trimmingCharacters(in: [" "])