Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Maybe it's related to your os....
try this:
Code:
<html>
<script type="text/javascript">
myString='\nje suis\nvraiment tres\ncontent';
var myStringArray=myString.split(String.fromCharCode(10));
if(myStringArray.length==1){
var myStringArray=myString.split(String.fromCharCode(13));
}
alert(myStringArray.length); //=> 4
</script>
</html>
the ascii code 10 is "carriage return", the ascii code 13 is "line feed".
Windows use cr+lr (\r\n) as end of line.
Linux use only cr (\r), mac use only lf (\n).
So, maybe your problem could be related to the os the text was stored from.
I'm not sure, but it's worth a try, I think.
And maybe if you could post a bit of code, I could help you more.
__________________
Only a biker knows why a dog sticks his head out the window.
|