- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 convert comma seperated java string to an array.
Yes, use String.split() method to do it. See the example below −
Example
public class Tester { public static void main(String[] args) { String text = "This,is,a,comma,seperated,string."; String[] array = text.split(","); for(String value:array) { System.out.print(value + " "); } } }
Output
This is a comma seperated string.
- Related Articles
- How to convert a comma separated String into an ArrayList in Java?
- How to convert an array to string in java?
- Java Program to Convert a List of String to Comma Separated String
- Convert a List of String to a comma separated String in Java
- Convert a Set of String to a comma separated String in Java
- how to convert Object array to String array in java
- Convert an ArrayList of String to a String array in Java
- How to convert array of comma separated strings to array of objects?
- how to convert vector to string array in java
- Write a program to convert an array to String in Java?
- Convert String into comma separated List in Java
- How to convert an array into JavaScript string?
- How to convert/store a string of numbers in to an array in java?
- How to convert string to array of integers in java?
- How to convert hex string to byte Array in Java?

Advertisements