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

Commit b34f6e4

Browse files
author
jerbri
committed
Renamed SafeSubstring param and supporting logic
SafeSubstring was passing "length" as "startIndex" incorrectly.
1 parent 9892c73 commit b34f6e4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,9 @@ public static string ToLowercaseUnderscore(this string value)
601601
return sb.ToString();
602602
}
603603

604-
public static string SafeSubstring(this string value, int length)
604+
public static string SafeSubstring(this string value, int startIndex)
605605
{
606-
return String.IsNullOrEmpty(value)
607-
? String.Empty
608-
: value.Substring(Math.Min(length, value.Length));
606+
return SafeSubstring(value, startIndex, value.Length);
609607
}
610608

611609
public static string SafeSubstring(this string value, int startIndex, int length)

0 commit comments

Comments
 (0)