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

    Sep 19, 2010 · When using substring the second parameter is the first index not to include: var s = "string"; s.substring(1, 3); // would return 'tr' var s = "another example"; s.substring(3, 7); // …

  2. string - javascript substring - Stack Overflow

    Apr 4, 2013 · javascript substring. Ask Question Asked 15 years, 5 months ago. Modified 4 years, 11 months ago. Viewed ...

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

    myArray.findIndex(element => element.includes("substring")) findIndex() is an ES6 higher order method that iterates through the elements of an array and returns the index of the first element …

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

    in this case we make use of the fact that the second argument of substr is a length, and that we know our substring is starting at 0. the top answer is not a generic solution because of the …

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

    Feb 11, 2010 · substring() extracts parts of a string and returns the extracted parts in a new string. Note #2: slice()==substring() Changes the Original String? slice() doesn't; substr() doesn't; …

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

    Jun 14, 2016 · 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 name …

  7. javascript - How to count string occurrence in string ... - Stack …

    Oct 24, 2010 · /** Function that count occurrences of a substring in a string; * @param {String} string The string * @param {String} subString The sub string to search for * @param …

  8. Regular expression to get a string between two strings in Javascript

    Extract substring between two string (excluding this two strings) Solution let allText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been …

  9. How to .substr () a integer in Javascript - Stack Overflow

    Deprecated: 'substr()' is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of …

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

    Jul 27, 2011 · To replace substring.But not working for me... var str='------check'; str.replace('-',''); Output: -----check Jquery removes first '-' from my text. I need to remove ...