C
C#3y ago
Grin

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

var allWithoutLastChar = txtBox_Calculation.Text[..^1];
9 Replies
MODiX
MODiX3y 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
GrinOP3y ago
wow good bot
MODiX
MODiX3y 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
Servator3y ago
.. from start ^ means from end
Grin
GrinOP3y ago
ah
Servator
Servator3y ago
^1 from end skip 1 char
Anchy
Anchy3y 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
GrinOP3y ago
ty how do I make this question solved? help section
Accord
Accord3y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server