Here you can find the source of quoteImpl(String s, char delim)
private static String quoteImpl(String s, char delim)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Firestar Software, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w ww . jav a 2s. co m * Firestar Software, Inc. - initial API and implementation * * Author: * Gabriel Oancea * *******************************************************************************/ public class Main { private static String quoteImpl(String s, char delim) { if (s == null) return null; StringBuffer sb = new StringBuffer(s.length() + 3); // two delims one // magic sb.append(delim); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == delim) sb.append(delim); sb.append(c); } sb.append(delim); return sb.toString(); } }