Alright, say I have the following string:
75 \r\n
95 64 \r\n
17 47 82
note that the numbers are seperated by space.
I want my array to have the following elements: 75 95 64 17 47 82.
I’ve been trying solving it for long but no luck yet..
Can anyone provide any solution or an idea for that?
It’s not homework.. I’m just trying to increase my knowledge on string manipulation exercieses.
EDIT: Please no LINQ solution since I don’t have any knowledge on that subject.
In C#:
The first parameter to Split() is an array of strings that determines what strings to look for in the input string to split around. The second parameter will make sure that any blank entries are removed from the split array.
The array still contains strings, but you can easily convert to your chosen number format afterwards (
short,int,ushort,uintetc ).