This commit is contained in:
parent
a42e51b609
commit
3f42af8215
@ -58,8 +58,17 @@ public class Iterations
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool FirstUpper(string s, string sub)
|
||||
public static string FirstUpper(string s)
|
||||
{
|
||||
return true;
|
||||
string phrase = s;
|
||||
string[] word = s.Split(' ');
|
||||
string result = String.Empty;
|
||||
foreach (var element in word)
|
||||
{
|
||||
string first = element.Substring(0, 1);
|
||||
result += first.ToUpper() + element.Substring(1) + " ";
|
||||
}
|
||||
|
||||
return result.TrimEnd();
|
||||
}
|
||||
}
|
@ -25,4 +25,14 @@ public class IterationTests
|
||||
bool actual = Iteration.Iterations.FindSub(s, sub);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("Je me crois en enfer, donc j'y suis.", "Je Me Crois En Enfer, Donc J'y Suis.")]
|
||||
[InlineData("!abc !def ghi .klm", "!abc !def Ghi .klm")]
|
||||
|
||||
public void CapitalizeTest(string s, string expected)
|
||||
{
|
||||
string actual = Iteration.Iterations.FirstUpper(s);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user