Java tutorial
//package com.java2s; public class Main { public static String getFieldString(String fields) { String[] fieldArr = fields.split("[,]"); StringBuilder result = new StringBuilder(); for (int i = 0, len = fieldArr.length; i < len; i++) { if (i > 0) { result.append("&"); } result.append("fields=").append(fieldArr[i]); } return result.toString(); } }