Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 59208ab

Browse files
committed
Add EndsWithIgnoreCase ext method
1 parent 9e6dae5 commit 59208ab

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,24 @@ public static bool StartsWithIgnoreCase(this string text, string startsWith)
491491
{
492492
#if NETFX_CORE
493493
return text != null
494-
&& text.StartsWith(startsWith, StringComparison.CurrentCultureIgnoreCase);
494+
&& text.StartsWith(endsWith, StringComparison.CurrentCultureIgnoreCase);
495495
#else
496496
return text != null
497497
&& text.StartsWith(startsWith, StringComparison.InvariantCultureIgnoreCase);
498498
#endif
499499
}
500500

501+
public static bool EndsWithIgnoreCase(this string text, string endsWith)
502+
{
503+
#if NETFX_CORE
504+
return text != null
505+
&& text.EndsWith(endsWith, StringComparison.CurrentCultureIgnoreCase);
506+
#else
507+
return text != null
508+
&& text.EndsWith(endsWith, StringComparison.InvariantCultureIgnoreCase);
509+
#endif
510+
}
511+
501512
public static string ReadAllText(this string filePath)
502513
{
503514
#if XBOX && !SILVERLIGHT

0 commit comments

Comments
 (0)