[Swift] Split String in Swift by their capital letters


Give a string and return an array with it capital letters.
For example:

Input: "ShowMeTheMoney"
Output: ["Show","Me","The","Money"]

---------------------------------------
解法1:
去巡覽每個字母,如果那個字母是大寫(capital letter),就在後面加一個空格(也可以用其他符號代替,但是用空格最好,晚一點說明)。之後整合成字串後再用Split分開成Array

留言