Package com.google.checkout.util

Examples of com.google.checkout.util.StringTuple


  public static String escapeXmlChars(String str) {

    String output = str;

    StringTuple[] arrStrTuple = {
        new StringTuple(Constants.ampStr, Constants.ampReplaceStr),
        new StringTuple(Constants.lessThanStr,
            Constants.lessThanReplaceStr),
        new StringTuple(Constants.greaterThanStr,
            Constants.greaterThanReplaceStr) };

    for (int i = 0; i < arrStrTuple.length; i++) {
      StringTuple strTuple = arrStrTuple[i];

      // Compile regular expression
      Pattern pattern = Pattern.compile(strTuple.getFirstElementString());

      // Replace all instances of the pattern
      Matcher matcher = pattern.matcher(output);
      output = matcher.replaceAll(strTuple.getSecondElementString());
    }
    return output;
  }
View Full Code Here

TOP

Related Classes of com.google.checkout.util.StringTuple

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.