❔ 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
TheRanger2y ago
first question: yes 2nd question: yes
Kultanen Mallu
Kultanen MalluOP2y ago
Do you know how? @TheRanger
TheRanger
TheRanger2y ago
yeah
Kultanen Mallu
Kultanen MalluOP2y ago
Could u give some example?
TheRanger
TheRanger2y 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
MODiX2y 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 MalluOP2y ago
Yeh. Like that
SG97
SG972y ago
why not use the original thread?
TheRanger
TheRanger2y ago
what original thread
SG97
SG972y ago
"How to sort files" 3 threads down
Denis
Denis2y ago
@Kultanen Mallu please do not delete threads https://discord.com/channels/143867839282020352/1080382935045259264 original post
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.
Want results from more Discord servers?
Add your server