Conversion of a Java string to a string array

Source: Internet
Author: User
Tags array to string

When working with a CSV file, it is often necessary to convert the string to a string array, or to a string array.

In the evening, we studied the string correlation function, which can be implemented by the split function and the join function.

As follows:

 Public classtestlist { Public Static voidMain (string[] args) {//TODO auto-generated Method StubString s = "A."; //string to string array using the Split functionString[] S_array=s.split (",");  for(String string:s_array) {System.out.println (string); } s_array[0]= "234"; String Delimetal=","; //string array to string with String.Join functionSystem.out.println (String.Join (Delimetal, S_array)); }}

Conversion of a Java string to a string array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.