🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.string.substring
String.Substring Method (System) | Microsoft Learn
Module Example Public Sub Main() Dim s As String = "aaaaabbbcccccccdd" Dim charRange As Char = "b"c Dim startIndex As Integer = s.Indexof(charRange) Dim endIndex As Integer = s.LastIndexOf(charRange) Dim length = endIndex - startIndex + 1 Console.WriteLine("{0}.Substring({1}, {2}) = {3}", s, startIndex, length, s.Substring(startIndex, length)) End Sub End Module ' The example displays the following output: ' aaaaabbbcccccccdd.Substring(5, 3) = bbb · If you've searched for multiple characters that are to mark the end of the substring, the length parameter equals endIndex + endMatchLength - startIndex, where endIndex is the return value of the IndexOf or LastIndexOf method, and endMatchLength is the length of the character sequence that marks the end of the substring.
🌐
Vultr Docs
docs.vultr.com › python › standard-library › str › index
Python str index() - Find Substring Index | Vultr Docs
November 26, 2024 - full_string = "Hello, welcome to Python. Welcome again!" substring = "welcome" limited_search = full_string.index(substring, 10) # Start searching from index 10 print(limited_search) Explain Code · Here, the search begins at index 10. It finds "Welcome" (case-sensitive search might be required for different outcomes) in "Welcome again!" part, displaying its starting index.
🌐
GeeksforGeeks
geeksforgeeks.org › python-get-the-starting-index-for-all-occurrences-of-given-substring
Python | Get the starting index for all occurrences of given substring - GeeksforGeeks
March 24, 2023 - We pass these variables as arguments to the get_substring_indices() function and store the result in the indices variable. Finally, we print the indices variable to see the starting index for all occurrences of the given substring.
🌐
GeeksforGeeks
geeksforgeeks.org › python › find-the-index-of-a-substring-in-python
Find the Index of a Substring in Python - GeeksforGeeks
July 23, 2025 - In this article, we will explore some simple and commonly used methods to find the index of a substring in Python. The find() method searches for the first occurrence of the specified substring and returns its starting index.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › substring
String.prototype.substring() - JavaScript - MDN Web Docs
The substring() method of String values returns the part of this string from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › String › indexOf
String.prototype.indexOf() - JavaScript - MDN Web Docs
The method returns the index of the first occurrence of the specified substring at a position greater than or equal to position, which defaults to 0. If position is greater than the length of the calling string, the method doesn't search the calling string at all.
🌐
freeCodeCamp
freecodecamp.org › news › python-find-how-to-search-for-a-substring-in-a-string
Python find() – How to Search for a Substring in a String
July 25, 2022 - It takes a substring as input and finds its index - that is, the position of the substring inside the string you call the method on. The general syntax for the find() method looks something like this: string_object.find("substring", ...
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string-index-method
Python String index() Method - GeeksforGeeks
May 2, 2025 - This code demonstrates how to find the index of a substring within a string using the index() method. ... Here, we only provide the substring argument "programming". index() searches from the start of the string and finds "programming" at index ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › system.string.indexof
String.IndexOf Method (System) | Microsoft Learn
The zero-based index position of value from the start of the current instance if that string is found, or -1 if it is not. If value is Empty, the return value is startIndex. ... The following example finds the index of all occurrences of the ...
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › java-string-indexof-method-example
Java String indexOf() Method
July 1, 2024 - It returns the index of first occurrence of character ch in the given string, starting the search from specified index fromIndex. If the character is not found, it returns -1. String str = "Hello, world!"; int index = str.indexOf('o', 5); // returns 8 ... It returns the index of the first ...
🌐
BeginnersBook
beginnersbook.com › 2013 › 12 › java-string-substring-method-example
Java String substring() Method with examples
The substring begins at the specified ....substring(4, 8) returns “urge” “smiles”.substring(1, 5) returns “mile” Parameters: beginIndex – the beginning index, inclusive....
🌐
CodeSignal
codesignal.com › learn › courses › practicing-string-operations-and-type-conversions-in-python › lessons › exploring-substring-search-in-python-strings
Exploring Substring Search in Python Strings
Here's our challenge: we have two ... "substrings". We're to identify all occurrences of each substring within its corresponding original string and return a list of the starting indices of these occurrences. Remember, index counting should start from 0....
🌐
W3Schools
w3schools.com › java › ref_string_indexof.asp
Java String indexOf() Method
String myStr = "Hello planet earth, you are a great planet."; System.out.println(myStr.indexOf("planet")); ... The indexOf() method returns the position of the first occurrence of specified character(s) in a string.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-index-and-slice-strings-in-python-3
How To Index and Slice Strings in Python | DigitalOcean
September 29, 2025 - ... Indexing: How to retrieve a single character from a string using its numerical position (index), both from the beginning (positive indices starting at 0) and from the end (negative indices starting at -1). Slicing: How to extract a substring (a “slice”) from a larger string using the ...
🌐
freeCodeCamp
freecodecamp.org › news › how-to-substring-a-string-in-python
How to Substring a String in Python
January 3, 2020 - This is often called "slicing". Here is the syntax: string[start:end:step] Where, start: The starting index of the substring. The character at this index is included in the substring.