Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Ulrik Andersson. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html * * Contributors: * Ulrik Andersson - initial API and implementation ******************************************************************************/ public class Main { private static String dbString(String val) { if (val != null) { val = val.replaceAll("'", "''"); return "'" + val + "'"; } return "null"; } }