C
C#2y ago
Grin

What does [..^1] represent in this line of code? [Answered]

var allWithoutLastChar = txtBox_Calculation.Text[..^1];
9 Replies
MODiX
MODiX2y ago
Toshiya Joshima#3472
REPL Result: Success
"Hello"[..^1]
"Hello"[..^1]
Result: string
Hell
Hell
Compile: 355.569ms | Execution: 37.259ms | React with ❌ to remove this embed.
Grin
Grin2y ago
wow good bot
MODiX
MODiX2y ago
Toshiya Joshima#3472
REPL Result: Success
"Hello"[..^0]
"Hello"[..^0]
Result: string
Hello
Hello
Compile: 353.091ms | Execution: 48.976ms | React with ❌ to remove this embed.
Servator
Servator2y ago
.. from start ^ means from end
Grin
Grin2y ago
ah
Servator
Servator2y ago
^1 from end skip 1 char
Anchy
Anchy2y ago
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.
Grin
Grin2y ago
ty how do I make this question solved? help section
Accord
Accord2y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server
More Posts