Java String Sanitize sanitize(String input)

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

Description

This function will remove all chars from the string that confuse dotty Currently '<' and '>' Expand this if you run into trouble with other chars

License

Open Source License

Parameter

Parameter Description
input a parameter

Declaration

private static String sanitize(String input) 

Method Source Code

//package com.java2s;
/*/*from   w ww  .  ja v a 2  s .  com*/
 * (C) Copyright 2010-2015 SAP SE.
 *
 * 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
 *
 */

public class Main {
    /**
     * This function will remove all chars from the string that confuse dotty
     * Currently '<' and '>'
     * Expand this if you run into trouble with other chars
     * @param input
     * @return
     */
    private static String sanitize(String input) {
        String output = "";

        for (char c : input.toCharArray()) {
            if (!(c == '<' || c == '>')) {
                output += c;
            } else {
                output += ' ';
            }
        }
        return output;
    }
}

Related

  1. sanitize(final String main)
  2. sanitize(final String name)
  3. sanitize(final String s)
  4. sanitize(final String singleOctets, byte[] dest)
  5. sanitize(String input)
  6. sanitize(String input, String prohibitedStringsRegexp)
  7. sanitize(String methodHeader)
  8. sanitize(String mimeType)
  9. sanitize(String original)