Here you can find the source of implode(StringBuilder sbuf, Object[] data, String separator)
Parameter | Description |
---|---|
sbuf | string buuilder. |
data | data to be parsed. |
separator | string separator |
public static void implode(StringBuilder sbuf, Object[] data, String separator)
//package com.java2s; /*//from ww w . j av a 2 s. co m * **************************************************************************** * Copyright 2010 University of California Santa Cruz * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * **************************************************************************** */ public class Main { /** * performs some rudimentary trimming of some text that is assumed * to contain an sql statement * * Given an input string, let L be the text before the first \n or \r, * with any whitespace removed from the beginning or end. * If L starts with "--", the empty string is returned. * Otherwise, L is returned. * * Less formally, return the empty string if the first line is empty or * only contains a comment. Otherwise, return the first line, trimmed, * with no terminating semicolon. * @param sbuf * string buuilder. * @param data * data to be parsed. * @param separator * string separator */ public static void implode(StringBuilder sbuf, Object[] data, String separator) { for (int i = 0; i < data.length; i++) { if (i > 0) sbuf.append(separator); sbuf.append(data[i]); } } }