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

Commit d79c36f

Browse files
committed
Fix SplitOnFirst(string)
1 parent 8f9e17b commit d79c36f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/ServiceStack.Text/StringExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public static string[] SplitOnFirst(this string strVal, string needle)
358358
var pos = strVal.IndexOf(needle);
359359
return pos == -1
360360
? new[] { strVal }
361-
: new[] { strVal.Substring(0, pos), strVal.Substring(pos + 1) };
361+
: new[] { strVal.Substring(0, pos), strVal.Substring(pos + needle.Length) };
362362
}
363363

364364
public static string[] SplitOnLast(this string strVal, char needle)
@@ -376,7 +376,7 @@ public static string[] SplitOnLast(this string strVal, string needle)
376376
var pos = strVal.LastIndexOf(needle);
377377
return pos == -1
378378
? new[] { strVal }
379-
: new[] { strVal.Substring(0, pos), strVal.Substring(pos + 1) };
379+
: new[] { strVal.Substring(0, pos), strVal.Substring(pos + needle.Length) };
380380
}
381381

382382
public static string WithoutExtension(this string filePath)

0 commit comments

Comments
 (0)