Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
138
rated 0 times [  145] [ 7]  / answers: 1 / hits: 20361  / 9 Years ago, fri, april 10, 2015, 12:00:00

We are Developing phonegap application.We get Data form CSV file. It's look like this We



We need Data Split into two strings Like

String1 enter



String2 enter



We tried like this but We don't have luck so Please guide me



var split = string.split('rn');


Please help me


More From » jquery

 Answers
20

Replace the new line characters with space and then split the string with space



string.replace( /n/g,   ).split( );


UPDATE:



var string1=string.substring(0,string.indexOf(TOTALAMOUNT));
var string2=string.substring(string.indexOf(TOTALAMOUNT),string.length);


Or if your string contains n then:



var string1=string.substring(0,string.indexOf(n));
var string2=string.substring(string.indexOf(n),string.length);


alert(string1);
alert(string


Fiddle


[#67125] Wednesday, April 8, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hollievalerier

Total Points: 431
Total Questions: 93
Total Answers: 105

Location: Montenegro
Member since Thu, Jun 16, 2022
2 Years ago
;