Result of .split on a null string 
Author Message
 Result of .split on a null string

If I execute:

var s = "";
var a = new Array ();
a = s.split(/,/);

why do I get a[0]="" ?

I expect to get a.length == 0, which I don't.  So guess what happens when
you change the above example to:

var s = ",";
var a = new Array ();
a = s.split(/,/);

Now a.length *is* 0, and a[0] is undefined!  Yuck!  I would at the worst
expect to get the same result as the top example.



Sun, 25 Mar 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. how to split a split string

2. Problem assigning Split() result to an array

3. UBound returns different result when array is created using Split()

4. how to handle NULL values from a FORM when using date string functions - help please

5. testing null string

6. Null string in Javascript

7. function to convert empty string to Null?

8. how to handle NULL values from a FORM when using date string functions - help please

9. null terminated string

10. Reading a Null Terminated String with VBS

11. Split string by regular expression (ie. date)

12. Splitting Strings

 

 
Powered by phpBB® Forum Software