extjs - Sencha Touch String Traversal -


i working on music notation app using sencha touch framework ext. have numerator field of type 'auto' int or string. have function return value of numerator, trivial if it's int, harder if string. string of form:

'2+3+2' 

so how can traverse numbers out? i've been trying parseint(() function, not proving useful.

what standard javascript functions? current format can parsed using function split:

var str = '2+3+2'; var numbers = str.split('+'); var sum = 0; (var = 0; < numbers.length; i++) {     sum += parseint(numbers[i]); } 

jsfiddle

note can use regular expression split's argument. useful if numbers may separated different symbols.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -