Android 2.3 js parsing problem split ()

Source: Internet
Author: User
Tags parse error

Android 2.3 Version number parsing error, split and parseint will both 09 and 08 are parsed into 0, 07 the following parsing no problem. The solution is to take single digits directly.


function Getymd (yMd) {

var darray=new Array ();
var yyyy=parseint (Ymd.tostring (). Split ("-") [0]);
var mm=parseint (Ymd.tostring (). Split ("-") [1]);
var dd=parseint (Ymd.tostring (). Split ("-") [2]);
if (mm==0) {
Mm=parseint (ymd.substring (6,7));Optimized for Android 2.3. Parse error. Will parse 09 and 08 into 0, 07 below parse no problem. The solution is to take single digits directly.

Otherwise, split and parseint have problems.
}
if (dd==0)
Dd=parseint (ymd.substring (9,10)); //For Android 2.3 optimization, parsing errors, will be 09 and 08 are resolved to 0, 07 the following parsing no problem. The solution is to take single digits directly. Otherwise, split and parseint have problems.
Darray.push (yyyy);
Darray.push (MM);
Darray.push (DD);
return darray;
}

Android 2.3 js parsing problem split ()

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.