Hello,
I have a string of values, to the effect of:
And I use componentsSeparatedByString to give me an array of 5 different values:
The problem is that some values have one space between them, others have two spaces, some even have three. So I get a very awkward array that is difficult to sort.
I know that I could loop through the array and drop a value if it contains nothing (or just a space) But I have around 250 of these strings to convert to an array and that would slow the process greatly. Is there a way to create the array while just ignoring those extra spaces?
Thanks!
I have a string of values, to the effect of:
Code:
string = "100 34 154 120 45"
Code:
array = [string componentsSeparatedByString:@" "];
I know that I could loop through the array and drop a value if it contains nothing (or just a space) But I have around 250 of these strings to convert to an array and that would slow the process greatly. Is there a way to create the array while just ignoring those extra spaces?
Thanks!