There is a string "[lightinthebox]", but I just need lightinthebox, just don't "[]". How to remove it in a fast and effective way?
stringObject.substring(start,stop) //The strings that intercept the start and end.
stringObject.substr(start,length) //The intercept is the beginning and the string length.
Taking these into account, the connection with the method.
stringObject.substr(1).substring(-1,0) //It's feasible
Let’s talk about the intercepting time here. Now we all want to change the single digit into two digits. For example, 9 is displayed as 09 for easier format alignment.
Many places determine whether this number is less than 10 to determine whether it is added 0.
If we use strings, we don’t have to judge. Add one and intercept the last two digits. 01, 010, 011 becomes 01 10 011