Top "Substring" questions

Part of a string, or the function/method that returns part of a string

Display only 10 characters of a long string?

How do I get a long text string (like a querystring) to display a maximum of 10 characters, using JQuery? Sorry …

javascript jquery substring string-length
Get value of a string after last slash in JavaScript

I am already trying for over an hour and cant figure out the right way to do it, although it …

javascript substring indexof slash
Python: Find a substring in a string and returning the index of the substring

I have: a function: def find_str(s, char) and a string: "Happy Birthday", I essentially want to input "py" …

python string indexing substring
How to find nth occurrence of character in a string?

Similar to a question posted here, am looking for a solution in Java. That is, how to find the index …

java string substring
Find the nth occurrence of substring in a string

This seems like it should be pretty trivial, but I am new at Python and want to do it the …

python string substring
How to check if a string contains text from an array of substrings in JavaScript?

Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array.

javascript arrays string substring contains
Replace substring with another substring C++

How could I replace a substring in a string with another substring in C++, what functions could I use? eg: …

c++ string replace substring
Regex to extract substring, returning 2 results for some reason

I need to do a lot of regex things in javascript but am having some issues with the syntax and …

javascript regex substring
How to use string.substr() function?

I want to make a program that will read some number in string format and output it like this: if …

c++ string substring
How can I replace a regex substring match in Javascript?

var str = 'asd-0.testing'; var regex = /asd-(\d)\.\w+/; str.replace(regex, 1); That replaces the entire string str with 1. I …

javascript regex replace substring