Java Object Type Case castForRegex(String textContent)

Here you can find the source of castForRegex(String textContent)

Description

cast For Regex

License

Apache License

Declaration

public static String castForRegex(String textContent) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String castForRegex(String textContent) {

        return textContent.replace("\\", "\\\\").replace("/", "\\/").replace("*", "\\*").replace("+", "\\+")
                .replace(".", "\\.").replace("?", "\\?").replace(")", "\\)").replace("{", "\\{").replace("}", "\\}")
                .replace("(", "\\(").replace("[", "\\[").replace("]", "\\]").replace("%", "\\%");
    }//from www.j a  v a  2s  .c  o  m
}

Related

  1. castAsDoubleArray(int[] input)
  2. castClass(Class aClass)
  3. castClone(U obj, T superClone)
  4. castEnum(Enum enum_param)
  5. castEnum(T from, U[] to)
  6. castingNum(double n)
  7. castingUtil(String value, Class classCasting)
  8. castInstance(Object o, Class clazz)
  9. castInttoLong(int x)