Javascript code to remove the first character and the last character
Source: Internet
Author: User
This article mainly introduces the implementation code for removing the first character and the last character from JS. If you need it, refer to it, I hope to help you with the "[lightinthebox]" character string, but I just need lightinthebox, that is, do not "[]". How can we remove it quickly and effectively.
StringObject. substring (start, stop) // captures the start and end strings.
StringObject. substr (start, length) // intercept the start and string length.
Considering this, it is related to methods.
StringObject. substr (1). substring (-) // It is feasible.
Here, by the way, there is a way to change a single position to two. For example, 9 is displayed as 09 to facilitate format alignment.
In many cases, you can determine whether the number is smaller than 10 to add 0.
If we use a string, we don't need to judge it. We just need to add one to all. We can just take the last two digits and 01,010,011 will become 01 10 011.
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.