This code is supposed to reverse all substrings which are five characters or more, but it keeps removing the whitespaces from the string, is there a reason to this, or am i just dumb?
public class Kata
{
public static string ReverseString(string myStr)
{
char[] myArr = myStr.ToCharArray();
Array.Reverse(myArr);
return new string (myArr);
}
public static string SpinWords(string sentence)
{
string[] words = sentence.Split(' ');
string s1;
string owo = "";
foreach (var word in words)
{
if (word.Length >= 5)
{
s1 = ReverseString(word);
owo = String.Concat(owo, s1 );
;
}
else
{
owo = String.Concat(owo, word );
}
}
return owo;
}
}