Java String Sanitize sanitize(String text)

Here you can find the source of sanitize(String text)

Description

sanitize

License

Open Source License

Declaration

private static String sanitize(String text) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Jeremie Bresson./*from   w w  w  .  j av  a2s . com*/
 * 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:
 *     Jeremie Bresson - initial API and implementation
 ******************************************************************************/

public class Main {
    private static final String CHAR_QUOTE = "\"";
    private static final String CHAR_8220 = Character.toString((char) 8220);
    private static final String CHAR_8221 = Character.toString((char) 8221);
    private static final String CHAR_8222 = Character.toString((char) 8222);

    private static String sanitize(String text) {
        String result = text;
        result = result.replaceAll(CHAR_8220, CHAR_QUOTE);
        result = result.replaceAll(CHAR_8221, CHAR_QUOTE);
        result = result.replaceAll(CHAR_8222, CHAR_QUOTE);
        return result;
    }
}

Related

  1. sanitize(String str)
  2. sanitize(String string)
  3. sanitize(String string, boolean allowWhitespace)
  4. sanitize(String string, String spaceReplace)
  5. sanitize(String text)
  6. sanitize(String value)
  7. sanitizeAppAlias(String appAlias)
  8. sanitizeAttribute(String value)
  9. sanitizeBranchName(String currentBranch)