softnshare / kata

Code Kata 這個概念是由 The Pragmatic Programmer 的作者之一Dave Thomas提出的, 想要提升自己的coding skill嗎? 歡迎加入這個slack channel, 加入請參考右邊網頁說明
https://softnshare.wordpress.com/slack/kata/
38 stars 4 forks source link

Split Strings #28

Open hatedinny1 opened 8 years ago

hatedinny1 commented 8 years ago

題目網址 : https://www.codewars.com/kata/515de9ae9dcfc28eb6000001

Description:

Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore ('_').

Examples: SplitString.Solution("abc"); // should return ["ab", "c_"] SplitString.Solution("abcdef"); // should return ["ab", "cd", "ef"]

中譯版本: 由呼叫端傳入一個字串,預期回傳一個字串陣列(字元兩兩一組), 若有不足一組則補上底線(_)。

Pass by C#