Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
134
rated 0 times [  136] [ 2]  / answers: 1 / hits: 16442  / 14 Years ago, wed, february 2, 2011, 12:00:00

I am reading a file with xmlHttp object and splitting the responseText with newlines by split method.



But n character literally doesn't work. It acts like an error in my code and causes my code not even function.
Here is the line:



var lines=myPlaylist.responseText.split(n);


There is no error if I split the array myPlaylist with other characters.
Just n causes problem which I fail to understand.



At first, I thought the error was due to white-space:nowrap since I execute my code on Chrome.
Though I never used white-space in anywhere, I tried to set it to normal but it didn't work.
Similarly, I tried my code on other browsers (Firefox, IE etc), it didn't work either. Looks like I have a problem with using n. Is there any other way to use newline or error with my code?



And by the way, error seems to be a syntax error since it does not just ignore n character. Simply causes my code not to work



EDIT: An example responseText



[playlist]

File1=http://localhost:7000/Videos/Big%20Buck%20Bunny%20Trailer.ogv
Title1=Bunny Trailer
Length1=23

File2=http://localhost:7000/Videos/Dizzy%20Cat%20Video.ogv
Title2=Kedi
Length2=33

NumberOfEntries=2

Version=2

More From » html

 Answers
20

I found my own solution to my problem.

After using random special characters, r character used for carriage return worked like a charm for my problem.

It acted like a newline n character or at least it did its job in my case.

Thanks everyone for answers and helpful comments.


[#93935] Monday, January 31, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ravenl

Total Points: 338
Total Questions: 107
Total Answers: 112

Location: Belize
Member since Mon, Jun 20, 2022
2 Years ago
ravenl questions
Thu, Feb 18, 21, 00:00, 3 Years ago
Tue, Jan 12, 21, 00:00, 3 Years ago
Tue, Mar 17, 20, 00:00, 4 Years ago
;