- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to extract certain substring from a string using Java?
You can extract a substring from a String using the substring() method of the String class to this method you need to pass the start and end indexes of the required substring.
Example
public class Substring { public static void main(String args[]) { String str = "Welcome to Tutorialspoint"; String sub = str.substring(10, 25); System.out.println(sub); } }
Output
Tutorialspoint
Advertisements