wrote:
> Could anyone please help me with the following problem
>
> My xml file is
> ==============
> <fig id="F0000001">
> <caption>Caption text</caption>
> <image id="I0000001" image.class="halftone" image.type="jpg" print="0"
> width="29-6" depth="23-6" pointer="I0000001.jpg"/>
> </fig>
>
> I need my output in IE Browser using Javascript as follows (need it in
> a loop, as I need to print in different places)
>
> fig id output
> ======== ========
> F0000001 1
> F0000021 21
> S0000001 1
> S0000021 21
To converting the string a primitive number assuming the format above:
var stringID = 'I00301';
var numberID = stringID.replace(/^\D*0*/,''); // --> 301
That will remove any leading non-digits and zeros in any browser that
supports regular expressions (which includes IE).
--
Rob