❔ I need help with String split

So is there a way if im splitting string to 3lines to remove the last string? Or is it possible to save first 2 lines as a string?
12 Replies
TheRanger
TheRanger3y ago
first question: yes 2nd question: yes
Kultanen Mallu
Kultanen MalluOP3y ago
Do you know how? @TheRanger
TheRanger
TheRanger3y ago
yeah
Kultanen Mallu
Kultanen MalluOP3y ago
Could u give some example?
TheRanger
TheRanger3y ago
so what do u mean by save first 2 lines as a string?, u want to join the string array into a single string?
MODiX
MODiX3y ago
TheRanger#3357
REPL Result: Success
string foo = "aaa bbb ccc";
string[] bar = foo.Split(" ")[..^1];
bar
string foo = "aaa bbb ccc";
string[] bar = foo.Split(" ")[..^1];
bar
Result: string[]
[
"aaa",
"bbb"
]
[
"aaa",
"bbb"
]
Compile: 540.516ms | Execution: 36.271ms | React with ❌ to remove this embed.
Kultanen Mallu
Kultanen MalluOP3y ago
Yeh. Like that
SG97
SG973y ago
why not use the original thread?
TheRanger
TheRanger3y ago
what original thread
SG97
SG973y ago
"How to sort files" 3 threads down
Denis
Denis3y ago
@Kultanen Mallu please do not delete threads https://discord.com/channels/143867839282020352/1080382935045259264 original post
Accord
Accord3y 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.

Did you find this page helpful?