C
C#2y ago
xdrum📝

❔ is it possible to add // at beginning of text line when caret is in current line?

Hello all, in a RichTextBox I split text by line, but I need to add the symbol // at the beginning of a line when caret is in it int index = new GetFirstCharIndexFromCurrentLine() int line = new GetLineFromCharIndex(iNdEx) string[] str = new rtb.Text.Split('/n');
2 Replies
Florian Voß
Florian Voß2y ago
string.Join("\n", str.Select(line => line.Contains("^") ? "//" + line : line))
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity. Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server