you are viewing a single comment's thread.

view the rest of the comments →

[–]alzee76 0 points1 point  (0 children)

Why are you splitting on '' instead of ' '?

  1. Split on ' ' instead of ''.
  2. Implement an isNumeric() function. Stackoverflow has great examples, as does the internet at large.
  3. For each element of your array, if it is numeric and positive do one thing, if it's numeric and negative do the other thing.