[ swift - 문자열 치환 ]

Yr Yr·2023년 11월 30일

TIL

목록 보기
5/39

* replacingOccurrences: 특정 문자를 다른 문자로 치환해주는 함수

replacingOccurrences(of: "", with: "")
-> of ""을 with ""으로 변경

let str = "12345"
let newStr = str.replacingOccurences(of: "2", with: "*")
print(newStr) // 1*345

1개의 댓글

comment-user-thumbnail
2023년 11월 30일

오늘도 고생하셨습니다 👏

답글 달기