Solutions for IEBUG and string truncation of substr _ basic knowledge

Source: Internet
Author: User
This article is a small part of this article for you to introduce the solutions for IEBUG and string truncation substr. If you need it, you can refer to it. I haven't paid attention to this problem all the time. I wanted to do this today:

The Code is as follows:


Var str = 'Hello world 8024 ';

Str. substr (-4, 4 );

A negative number is counted from the end.

Should Return: 8024

But found the IE6-IE8, The substr parameter does not support negative numbers, the returned is: hell, you can test it.


Therefore, we do not recommend using this substr method.
Use the substring method instead.

For example, str. substring (str. length-4 );
8024 is returned.

Related Article

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.