About 2,240,000 results
Open links in new tab
  1. javascript - What is the difference between substr and substring ...

    Sep 19, 2010 · I think the more important question is "why does JavaScript have both a substr method and a substring method"? This is really the preferred method of overloading?

  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, 9 months ago Modified 11 months ago Viewed 724k times

  4. How to use substring () when the string has a space in it

    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 …

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

    The native JavaScript String method substr [MDN] can accomplish what you need. Just supply the starting index and omit the length parameter, and it grabs all the way to the end. Now, how to …

  6. 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?

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

    O segundo parâmetro de substring() é para encerrar a string e não incluir no caso o caracter da posição especificada. O segundo parâmetro de substr() especifica o tamanho máximo a ser …

  8. 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 …

  9. javascript - How do you search an array for a substring match?

    1 ref: In javascript, how do you search an array for a substring match The solution given here is generic unlike the solution 4556343#4556343, which requires a previous parse to identify a …

  10. javascript - How to count string occurrence in string? - Stack …

    It depends on whether you accept overlapping instances, e.g. var t = "sss"; How many instances of the substring "ss" are in the string above? 1 or 2? Do you leapfrog over each instance, or …