

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Split String with Dot (.) in Java
Let’s say the following is our string.
String str = "This is demo text.This is sample text!";
To split a string with dot, use the split() method in Java.
str.split("[.]", 0);
The following is the complete example.
Example
public class Demo { public static void main(String[] args) { String str = "This is demo text.This is sample text!"; String[] res = str.split("[.]", 0); for(String myStr: res) { System.out.println(myStr); } } }
Output
This is demo text This is sample text!
- Related Questions & Answers
- Java Program to split a string with dot
- How to use Java String.split() method to split a string by dot?
- Split String with Comma (,) in Java
- Split a string in Java
- Java String split() method example.
- Java StringTokenizer and String Split Example.
- How to split a Java String into tokens with StringTokenizer?
- How to split a string in Java?
- How to split a string with a string delimiter in C#?
- Pattern split() method in Java with examples
- Java regex program to split a string with line endings as delimiter
- How to Split String in Java using Regular Expression?
- Split a string around a particular match in Java
- How to Split a String with Escaped Delimiters?
- Java program to split and join a string
Advertisements