Split string into two parts

Viewed 86314

I know there are several ways to split an array in jQuery but I have a special case: If I have for example this two strings:

 "G09.4 What"
 "A04.3  A new Code"

When I split the first by ' ' I can simply choose the code in front with [0] what would be G09.4. And when I call [1] I get the text: What

But when I do the same with the second string I get for [1] A but I want to retrieve A new Code.

So how can I retrieve for each string the code and the separate text?

6 Answers
Related