Java String Escape addEscapeCharactersForSpaces(String s)

Here you can find the source of addEscapeCharactersForSpaces(String s)

Description

add Escape Characters For Spaces

License

Open Source License

Declaration

public static String addEscapeCharactersForSpaces(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String addEscapeCharactersForSpaces(String s) {
        String outputString = "";

        for (int i = 0; i < s.length(); ++i) {
            if (s.charAt(i) == ' ')
                outputString = outputString.concat("\\");
            outputString = outputString.concat(s.substring(i, i + 1));
        }/*from  w w w.  ja v a  2s .co m*/

        return outputString;
    }
}

Related

  1. addEscape(String a_unescaped)
  2. addEscapeCapacityToRegex(String inputRegex)
  3. addEscapeChar(String str)
  4. addEscapeCharsToBackSlash(String code)
  5. addEscapes(String s)
  6. addEscapes(String str)
  7. addEscapeSequence(String inputStr)