Here you can find the source of array2string(String[] s)
Parameter | Description |
---|---|
s | The array to be serialized |
public static String array2string(String[] s)
//package com.java2s; //License from project: LGPL public class Main { private static final String STARTTAG = "|s|"; private static final String ENDTAG = "|/s|"; /**/*from w ww .j a v a2 s. c o m*/ * Serialize a string array into a single string. * This method uses <code>STARTTAG</code> and <code>ENDTAG</code> to * serialize single entries of a string array into one string. * * @param s The array to be serialized * @return A string containing the serialized version of the array */ public static String array2string(String[] s) { StringBuffer buf = new StringBuffer(); if (s == null) { return ""; } for (int i = 0; i < s.length; i++) { buf.append(STARTTAG); buf.append(s[i]); buf.append(ENDTAG); } return buf.toString(); } }