Filter by Tags

How can I split a string using Java ?

Votes

0

0 0

In Java, how can I split a string ? For example, if I have a string "Hello-World" then how can I split it in two parts


Hello


World

Open E-School
Posted on : Fri, Jan 19, 2018
Views : 77
Comments

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


0

In Java the string class has a split function which can be used to split a string based on a character or a substring. For example in the code example below we are splitting the string based on the character -

String data = "Hello-world";

String[] array = data.split("-");

For more understanding please go through this article

http://openeschool.com/tutorial/3217/how-to-split-a-string-using-java 

Ravinder Singh
Fri, Jan 19, 2018
Loading...
Comments

Edit Answer

Submit
This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp