diff options
author | Justin Van Patten <jvp@justinvp.com> | 2017-01-19 23:19:54 +0300 |
---|---|---|
committer | Justin Van Patten <jvp@justinvp.com> | 2017-01-25 19:16:30 +0300 |
commit | 0a030699a75b6e6c80745a29e743758115630df6 (patch) | |
tree | 0ba71c1df880ab4193c124a5fb92ad6917e027d7 /src/System.Runtime | |
parent | ef50cb834c4f1d2b5e99afcf88a40bb85bae9402 (diff) |
Expose String.Trim overloads that take a single char
Diffstat (limited to 'src/System.Runtime')
-rw-r--r-- | src/System.Runtime/ref/System.Runtime.cs | 3 | ||||
-rw-r--r-- | src/System.Runtime/tests/System/StringTests.cs | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index 7cd6903bad..c4479c7682 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -2099,8 +2099,11 @@ namespace System public System.String ToUpper(System.Globalization.CultureInfo culture) { throw null; } public string ToUpperInvariant() { throw null; } public string Trim() { throw null; } + public string Trim(char trimChar) { throw null; } public string Trim(params char[] trimChars) { throw null; } + public string TrimEnd(char trimChar) { throw null; } public string TrimEnd(params char[] trimChars) { throw null; } + public string TrimStart(char trimChar) { throw null; } public string TrimStart(params char[] trimChars) { throw null; } } public enum StringComparison diff --git a/src/System.Runtime/tests/System/StringTests.cs b/src/System.Runtime/tests/System/StringTests.cs index db92512b29..39d0300e89 100644 --- a/src/System.Runtime/tests/System/StringTests.cs +++ b/src/System.Runtime/tests/System/StringTests.cs @@ -2313,6 +2313,12 @@ namespace System.Tests { Assert.Equal(expected, s.Trim()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.Trim(trimChars[0])); + } + Assert.Equal(expected, s.Trim(trimChars)); } @@ -2331,6 +2337,12 @@ namespace System.Tests { Assert.Equal(expected, s.TrimEnd()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.TrimEnd(trimChars[0])); + } + Assert.Equal(expected, s.TrimEnd(trimChars)); } @@ -2349,6 +2361,12 @@ namespace System.Tests { Assert.Equal(expected, s.TrimStart()); } + + if (trimChars?.Length == 1) + { + Assert.Equal(expected, s.TrimStart(trimChars[0])); + } + Assert.Equal(expected, s.TrimStart(trimChars)); } |