About 54 results
Open links in new tab
  1. javascript - What is the difference between substr and substring ...

    Sep 19, 2010 · As hinted at in yatima2975's answer, there is an additional difference: substr() accepts a negative starting position as an offset from the end of the string. substring() does …

  2. string - javascript substring - Stack Overflow

    Apr 4, 2013 · You're confusing substring() and substr(): substring() expects two indices and not offset and length. In your case, the indices are 5 and 2, ie characters 2..4 will be returned as …

  3. How to grab substring before a specified character in JavaScript?

    How to grab substring before a specified character in JavaScript? Asked 13 years, 11 months ago Modified 1 year, 1 month ago Viewed 725k times

  4. javascript - Qual é a diferença entre substr () e substring ()? - Stack ...

    A diferença é que o substr trabalha com quantidades de caracteres (especificada ou não no segundo parâmetro) a partir de uma posição index (índice) da string (especificada no primeiro …

  5. How can I cut a substring from a string to the end using Javascript ...

    9 This may be new, but the substring method returns everything from a specified index to the end of the string.

  6. javascript - What is the difference between String.slice and String ...

    Feb 11, 2010 · Distinctions of substring(): If start > stop, then substring will swap those 2 arguments. If either argument is negative or is NaN, it is treated as if it were 0. Distinctions of …

  7. javascript - How to use substring () when the string has a space in …

    Jun 14, 2016 · 4 I have a string containing a person's first and last name such as John Doe. I would like to convert this string to John D. Normally, I would just use substring(0,1) on the last …

  8. How to replace substring in Javascript? - Stack Overflow

    Nov 27, 2016 · How to replace substring in Javascript? Asked 15 years, 1 month ago Modified 5 years ago Viewed 50k times

  9. Get Substring between two characters using JavaScript

    Feb 14, 2013 · Get Substring between two characters using JavaScript Asked 12 years, 11 months ago Modified 1 year, 7 months ago Viewed 628k times

  10. How to check whether a string contains a substring in JavaScript ...

    Nov 24, 2009 · Usually I would expect a String.contains() method, but there doesn't seem to be one. What is a reasonable way to check for this?