If you know the length of characters to be extracted, you could use substr(), but that is discouraged as it is deprecated.If you know the index (the position) on which you'll stop (but NOT include), use slice().Source: Rudimentary Art of Programming & Development: Javascript: substr() v.s. If stop is negative: sets stop to: string.length – Math.abs(stop) (original value), except bounded at 0 (thus, Math.max(0, string.length + stop)) as covered in the ECMA specification.This behavior is observed in both Firefox and IE. If start is negative: sets char from the end of string, exactly like substr() in Firefox.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |