What does [..^1] represent in this line of code? [Answered]
var allWithoutLastChar = txtBox_Calculation.Text[..^1];
9 Replies
Toshiya Joshima#3472
REPL Result: Success
Result: string
Compile: 355.569ms | Execution: 37.259ms | React with ❌ to remove this embed.
wow good bot
Toshiya Joshima#3472
REPL Result: Success
Result: string
Compile: 353.091ms | Execution: 48.976ms | React with ❌ to remove this embed.
.. from start
^ means from end
ah
^1 from end skip 1 char
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/ranges
some extra reading
Ranges and indices - C# 8.0 draft specifications
This feature specification describes the syntax for ranges and indices, which support indexing individual elements of a sequence or a range of a sequence from the start or end of that sequence.
ty
how do I make this question solved?
help section
✅ This post has been marked as answered!