Skip to content

Commit c83c86c

Browse files
committed
Replace "Substring" with range syntax
1 parent 751f10f commit c83c86c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/DocoptNet/Docopt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ static IEnumerable<Option> ParseShorts(Tokens tokens, ICollection<Option> option
404404
while (left != "")
405405
{
406406
var shortName = "-" + left[0];
407-
left = left.Substring(1);
407+
left = left[1..];
408408
var similar = options.Where(o => o.ShortName == shortName).ToList();
409409
Option option;
410410
if (similar.Count > 1)

src/DocoptNet/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static class Extensions
1414
public static (string, string, string) Partition(this string input, string separator)
1515
{
1616
return input.IndexOf(separator, System.StringComparison.Ordinal) is var i and >= 0
17-
? (input.Substring(0, i), separator, input.Substring(i + separator.Length))
17+
? (input[..i], separator, input[(i + separator.Length)..])
1818
: (input, string.Empty, string.Empty);
1919
}
2020
}

0 commit comments

Comments
 (0)