[Xerte] Re: Array length when none expected
Julian Tenney
Julian.Tenney at nottingham.ac.uk
Wed Mar 14 10:59:26 GMT 2012
The xml is a red herring:
This explains it:
string = "hi";
arr = string.split('~');
debug(arr.length); //debugs 1?
debug(arr[0]); //debugs hi
So:
string = ""; //AN EMPTY STRING
arr = string.split('~');
debug(arr.length); //debugs 1
debug(arr[0]); //debugs EMPTY STRING
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 March 2012 10:30
To: Xerte list
Subject: [Xerte] Array length when none expected
feedback_right is an XML CDATA node that is read in
<RRIGHT x="50" y="200">
<![CDATA[]]>
</RRIGHT>
rarray = feedback_right.toString().split('~');
debug(feedback_right); //blank
debug(rarray); //blank
debug(rarray.length); // 1
Why is it exhibiting length?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20120314/a21fcfbc/attachment.html>
More information about the Xerte
mailing list