- 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 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.
Advertisements