🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › String.html
String (Java Platform SE 8 )
July 21, 2026 - The class String includes methods ... for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase. Case mapping is based on the Unicode Standard version specified by the Character class. The Java language provides ...
🌐
Great Learning
mygreatlearning.com › blog › it/software development › java substring: an in-depth guide
Java Substring: An In-depth Guide
September 3, 2024 - One such powerful method that Java provides for string manipulation is the `substring()` method, a part of the `java.lang.String` class. It is used for extracting a portion of a string and creating a new string from it.
🌐
Reddit
reddit.com › r/learnprogramming › how to correctly use the substring method? (java)
r/learnprogramming on Reddit: How to correctly use the substring method? (Java)
February 2, 2013 -

Hey guys, I've been working on this Java homework for my class and this whole section about string manipulation is confusing me.

The homework asks to add statements that use the substring method to get the first half and second half of phrase.

I'm assuming that means using the substring method, but I always get errors trying to compile what I put in. So here's the code. I'm not exactly sure how to use the substring method in the way they ask, and my book doesn't really go over it well. Should I be creating another variable or just use what I have?

🌐
GeeksforGeeks
geeksforgeeks.org › java › substring-in-java
Java String substring() Method - GeeksforGeeks
April 11, 2025 - In Java, the substring() method of the String class returns a substring from the given string.
🌐
YouTube
youtube.com › watch
Java substrings are easy! 📧 - YouTube
#java #javatutorial #javacourse This is a beginner's introduction to substrings and we'll use it to code an email slicer that extracts a username and domain ...
Published: December 5, 2024
🌐
Baeldung
baeldung.com › home › java › java string › get substring from string in java
Get Substring from String in Java | Baeldung
July 21, 2024 - For more details on the Java regular expressions check out this tutorial. We can use the split method from the String class to extract a substring. Say we want to extract the first sentence from the example String.
🌐
HappyCoders
happycoders.eu › home › java › java substring() method: how to use it and how it works
Java substring() Method: How to Use It and How It Works
4 weeks ago - The string constructor used in the first line checks whether the string passed is a substring. If so, it creates a copy of the requested section. The string concatenation used in the second line only leads to the desired result as of Java 5 (see below).
Find elsewhere
🌐
CodeGym
codegym.cc › java blog › strings in java › substring in java
Java String substring()
July 23, 2024 - Java Substring in general is a contiguous sequence of characters inside the String. It could be a part of the String or the whole String as well. What is substring in Java? This language has a substring() method, or rather two methods, thanks ...
🌐
Codecademy
codecademy.com › docs › java › strings › .substring()
Java | Strings | .substring() | Codecademy
April 28, 2025 - The .substring() method in Java returns a portion of a string from a specified starting index to an (optional) ending index.
🌐
Medium
maheshjtp.medium.com › what-is-a-substring-in-java-syntax-applications-of-java-substring-9abbf79350e9
What is a Substring in Java? Syntax/ Applications of Java Substring | by Mahesh Sharma | Medium
March 7, 2025 - In the realm of Java programming, the substring functionality stands as a powerful tool for manipulating and extracting portions of text data within strings.
🌐
GeeksforGeeks
geeksforgeeks.org › java › searching-for-characters-and-substring-in-a-string-in-java
Searching For Characters and Substring in a String in Java - GeeksforGeeks
July 23, 2025 - // Java Program to Match ofstart and endof a Substring import java.io.*; class GFG { public static void main(String[] args) { // Input string in which substring // is to be searched String s = "GeeksforGeeks is a computer science portal"; // Print and display commands System.out.println(s.startsWith("Geek")); System.out.println(s.startsWith("is", 14)); System.out.println(s.endsWith("port")); } }
🌐
Tpoint Tech
tpointtech.com › substring-in-java
Substring in Java (With Examples) - Tpoint Tech
1 week ago - The substring() method of the String class is used to extract a part of a string based on index positions.
🌐
Medium
medium.com › @nikhilsalvi011 › substring-string-class-methods-7be01c1c06d0
Substring & String Class Methods. A part of String is called substring… | by Nikhil Sambhaji Salvi | Medium
November 1, 2023 - A part of String is called substring. In other words, substring is a subset of another String. Java String class provides the built-in substring() method that extract a substring from the given string by using the index values passed as an argument.
🌐
IONOS
ionos.com › digital guide › websites › web development › java substrings
How to use the Java substring method - IONOS
January 6, 2025 - There are two different ways to use it, either sep­a­rat­ing the string from an index to the end or with a pre-defined beginning and ending index for the substring. In Java, char­ac­ters, digits and special char­ac­ters can be combined into a Java string.
🌐
TechVidvan
techvidvan.com › tutorials › java-string-substring
Java String substring() - TechVidvan
December 2, 2025 - A portion of a string is returned by the Java String class substring(). We pass beginIndex and endIndex number position in the Java substring method where beginIndex is inclusive, and endIndex is exclusive.
🌐
DevGenius
blog.devgenius.io › java-substring-a-comprehensive-guide-082192995d1e
Java Substring Failed When Input Changed Shape | Dev Genius
July 6, 2026 - A substring is a sequence of characters derived from another string. For example, in the string "Hello, World!", the substrings "Hello", "World", and "lo, Wo" are all valid substrings.
🌐
Quora
quora.com › How-do-you-use-substring-and-lastIndexOf-in-Java
How to use substring and lastIndexOf in Java - Quora
Answer: The substring() method extracts characters, between two indices (positions), from a string, and returns the substring. The substring() method extracts characters from start to end (exclusive). The substring() method does not change the original string. The lastIndexOf() method returns th...