Example usage for java.lang Character toString

List of usage examples for java.lang Character toString

Introduction

In this page you can find the example usage for java.lang Character toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Character 's value.

Usage

From source file:com.example.dlp.DeIdentification.java

private static void deIdentifyWithMask(String string, Character maskingCharacter, int numberToMask) {
    // [START dlp_deidentify_mask]
    /**//from  w  ww .  j a va 2 s .c om
     * Deidentify a string by masking sensitive information with a character using the DLP API.
     * @param string The string to deidentify.
     * @param maskingCharacter (Optional) The character to mask sensitive data with.
     * @param numberToMask (Optional) The number of characters' worth of sensitive data to mask.
     *                     Omitting this value or setting it to 0 masks all sensitive chars.
     */

    // instantiate a client
    try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {

        // string = "My SSN is 372819127";
        // numberToMask = 5;
        // maskingCharacter = 'x';

        ContentItem contentItem = ContentItem.newBuilder().setType("text/plain").setValue(string).build();

        CharacterMaskConfig characterMaskConfig = CharacterMaskConfig.newBuilder()
                .setMaskingCharacter(maskingCharacter.toString()).setNumberToMask(numberToMask).build();

        // Create the deidentification transformation configuration
        PrimitiveTransformation primitiveTransformation = PrimitiveTransformation.newBuilder()
                .setCharacterMaskConfig(characterMaskConfig).build();

        InfoTypeTransformation infoTypeTransformationObject = InfoTypeTransformation.newBuilder()
                .setPrimitiveTransformation(primitiveTransformation).build();

        InfoTypeTransformations infoTypeTransformationArray = InfoTypeTransformations.newBuilder()
                .addTransformations(infoTypeTransformationObject).build();

        // Create the deidentification request object
        DeidentifyConfig deidentifyConfig = DeidentifyConfig.newBuilder()
                .setInfoTypeTransformations(infoTypeTransformationArray).build();

        DeidentifyContentRequest request = DeidentifyContentRequest.newBuilder()
                .setDeidentifyConfig(deidentifyConfig).addItems(contentItem).build();

        // Execute the deidentification request
        DeidentifyContentResponse response = dlpServiceClient.deidentifyContent(request);

        // Print the character-masked input value
        // e.g. "My SSN is 123456789" --> "My SSN is *********"
        for (ContentItem item : response.getItemsList()) {
            System.out.println(item.getValue());
        }
    } catch (Exception e) {
        System.out.println("Error in deidentifyWithMask: " + e.getMessage());
    }
    // [END dlp_deidentify_mask]
}

From source file:net.ae97.pokebot.extensions.faq.FaqExtension.java

public String[] splitFactoid(String line) {
    for (Character ch : delimiters) {
        if (line.contains(ch.toString())) {
            return line.split(ch.toString());
        }/*w w  w.  j  a v a 2 s  .  com*/
    }
    return new String[] { line };
}

From source file:edu.buffalo.cse.pigout.Main.java

static int run(String args[], PigProgressNotificationListener listener) {
    int rc = 1;/*from  w ww  .  j  av  a  2  s.  c  o  m*/
    boolean verbose = false;
    boolean pigoutCalled = false;
    String logFileName = null;

    try {
        Configuration conf = new Configuration(false);
        GenericOptionsParser parser = new GenericOptionsParser(conf, args);
        conf = parser.getConfiguration();

        // create and update properties from configurations
        Properties properties = new Properties();
        PropertiesUtil.loadDefaultProperties(properties);
        PropertiesUtil.loadPropertiesFromFile(properties, "./conf/pigout.properties");
        properties.putAll(ConfigurationUtil.toProperties(conf));

        for (String key : properties.stringPropertyNames()) {
            log.debug(key + " = " + properties.getProperty(key));
        }

        if (listener == null) {
            listener = makeListener(properties);
        }
        String[] pigArgs = parser.getRemainingArgs();

        boolean userSpecifiedLog = false;
        boolean checkScriptOnly = false;

        BufferedReader pin = null;
        boolean debug = false;
        boolean dryrun = false;
        boolean embedded = false;
        List<String> params = new ArrayList<String>();
        List<String> paramFiles = new ArrayList<String>();
        HashSet<String> disabledOptimizerRules = new HashSet<String>();

        CmdLineParser opts = new CmdLineParser(pigArgs);
        opts.registerOpt('4', "log4jconf", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('b', "brief", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('c', "check", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('d', "debug", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('e', "execute", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('f', "file", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('g', "embedded", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('h', "help", CmdLineParser.ValueExpected.OPTIONAL);
        opts.registerOpt('i', "version", CmdLineParser.ValueExpected.OPTIONAL);
        opts.registerOpt('l', "logfile", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('m', "param_file", CmdLineParser.ValueExpected.OPTIONAL);
        opts.registerOpt('p', "param", CmdLineParser.ValueExpected.OPTIONAL);
        opts.registerOpt('r', "dryrun", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('t', "optimizer_off", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('v', "verbose", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('w', "warning", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('x', "exectype", CmdLineParser.ValueExpected.REQUIRED);
        opts.registerOpt('F', "stop_on_failure", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('M', "no_multiquery", CmdLineParser.ValueExpected.NOT_ACCEPTED);
        opts.registerOpt('P', "propertyFile", CmdLineParser.ValueExpected.REQUIRED);

        ExecMode mode = ExecMode.UNKNOWN;
        String file = null;
        String engine = null;
        ExecType execType = ExecType.LOCAL;

        // set up client side system properties in UDF context
        UDFContext.getUDFContext().setClientSystemProps(properties);

        char opt;
        //properties.setProperty("opt.multiquery",""+true);

        while ((opt = opts.getNextOpt()) != CmdLineParser.EndOfOpts) {
            switch (opt) {
            case '4':
                String log4jconf = opts.getValStr();
                if (log4jconf != null) {
                    properties.setProperty(LOG4J_CONF, log4jconf);
                }
                break;

            case 'b':
                properties.setProperty(BRIEF, "true");
                break;

            case 'c':
                checkScriptOnly = true;
                break;

            case 'd':
                String logLevel = opts.getValStr();
                if (logLevel != null) {
                    properties.setProperty(DEBUG, logLevel);
                }
                debug = true;
                break;

            case 'e':
                mode = ExecMode.STRING;
                break;

            case 'f':
                mode = ExecMode.FILE;
                file = opts.getValStr();
                break;

            case 'g':
                embedded = true;
                engine = opts.getValStr();
                break;

            case 'F':
                properties.setProperty("stop.on.failure", "" + true);
                break;

            case 'h':
                String topic = opts.getValStr();
                if (topic != null) {
                    System.out.println("Topic based help is not provided yet.");
                    usage();
                } else
                    usage();
                return ReturnCode.SUCCESS;

            case 'i':
                System.out.println(getVersionString());
                return ReturnCode.SUCCESS;

            case 'l':
                //call to method that validates the path to the log file
                //and sets up the file to store the client side log file
                String logFileParameter = opts.getValStr();
                if (logFileParameter != null && logFileParameter.length() > 0) {
                    logFileName = validateLogFile(logFileParameter, null);
                } else {
                    logFileName = validateLogFile(logFileName, null);
                }
                userSpecifiedLog = true;
                properties.setProperty("pig.logfile", (logFileName == null ? "" : logFileName));
                break;

            case 'm':
                //adds a parameter file
                paramFiles.add(opts.getValStr());
                break;

            case 'M':
                // turns off multiquery optimization
                properties.setProperty("opt.multiquery", "" + false);
                break;

            case 'p':
                //adds a parameter
                params.add(opts.getValStr());
                break;

            case 'r':
                // currently only used for parameter substitution
                // will be extended in the future
                dryrun = true;
                break;

            case 't':
                //disables a opt rule
                disabledOptimizerRules.add(opts.getValStr());
                break;

            case 'v':
                properties.setProperty(VERBOSE, "" + true);
                verbose = true;
                break;

            case 'w':
                properties.setProperty("aggregate.warning", "" + false);
                break;

            case 'x':
                //sets execution type:
                try {
                    execType = ExecType.fromString(opts.getValStr());
                } catch (IOException e) {
                    throw new RuntimeException("ERROR: Unrecognized exectype.", e);
                }
                break;

            case 'P': {
                InputStream inputStream = null;
                try {
                    FileLocalizer.FetchFileRet localFileRet = FileLocalizer.fetchFile(properties,
                            opts.getValStr());
                    inputStream = new BufferedInputStream(new FileInputStream(localFileRet.file));
                    properties.load(inputStream);
                } catch (IOException e) {
                    throw new RuntimeException("Unable to parse properties file '" + opts.getValStr() + "'");
                } finally {
                    if (inputStream != null) {
                        try {
                            inputStream.close();
                        } catch (IOException e) {
                        }
                    }
                }
            }
                break;

            default: {
                Character cc = Character.valueOf(opt);
                throw new AssertionError("Unhandled option " + cc.toString());
            }
            }
        }

        // create the context with the parameter
        PigContext pigContext = new PigContext(execType, properties);

        // create the static script state object
        String commandLine = LoadFunc.join((AbstractList<String>) Arrays.asList(args), " ");
        ScriptState scriptState = ScriptState.start(commandLine, pigContext);
        if (listener != null) {
            scriptState.registerListener(listener);
        }

        pigContext.getProperties().setProperty("pig.cmd.args", commandLine);

        if (logFileName == null && !userSpecifiedLog) {
            logFileName = validateLogFile(properties.getProperty("pig.logfile"), null);
        }

        pigContext.getProperties().setProperty("pig.logfile", (logFileName == null ? "" : logFileName));

        // configure logging
        configureLog4J(properties, pigContext);

        log.info(getVersionString().replace("\n", ""));

        if (logFileName != null) {
            log.info("Logging error messages to: " + logFileName);
        }

        if (!Boolean.valueOf(properties.getProperty(PROP_FILT_SIMPL_OPT, "false"))) {
            //turn off if the user has not explicitly turned on this optimization
            disabledOptimizerRules.add("FilterLogicExpressionSimplifier");
        }
        pigContext.getProperties().setProperty("pig.optimizer.rules",
                ObjectSerializer.serialize(disabledOptimizerRules));

        PigContext.setClassLoader(pigContext.createCl(null));

        // construct the parameter substitution preprocessor
        PigOutSh pigOutSh = null;
        BufferedReader in;
        String substFile = null;

        paramFiles = fetchRemoteParamFiles(paramFiles, properties);
        pigContext.setParams(params);
        pigContext.setParamFiles(paramFiles);

        switch (mode) {
        case FILE: {
            String remainders[] = opts.getRemainingArgs();

            if (remainders != null) {
                pigContext.getProperties().setProperty(PigContext.PIG_CMD_ARGS_REMAINDERS,
                        ObjectSerializer.serialize(remainders));
            }

            FileLocalizer.FetchFileRet localFileRet = FileLocalizer.fetchFile(properties, file);
            if (localFileRet.didFetch) {
                properties.setProperty("pig.jars.relative.to.dfs", "true");
            }

            scriptState.setFileName(file);

            if (embedded) {
                return runEmbeddedScript(pigContext, localFileRet.file.getPath(), engine);
            } else {
                SupportedScriptLang type = determineScriptType(localFileRet.file.getPath());

                log.debug("File: " + localFileRet.file.getPath() + " Script type: " + type);

                if (type != null) {
                    return runEmbeddedScript(pigContext, localFileRet.file.getPath(),
                            type.name().toLowerCase());
                }
            }
            //Reader is created by first loading "pigout.load.default.statements" or .pigoutbootup file if available
            in = new BufferedReader(new InputStreamReader(
                    Utils.getCompositeStream(new FileInputStream(localFileRet.file), properties)));

            //run parameter substitution preprocessor first
            substFile = file + ".substituted";

            pin = runParamPreprocessor(pigContext, in, substFile, debug || dryrun || checkScriptOnly);

            if (dryrun) {
                if (dryrun(substFile, pigContext)) {
                    log.info("Dry run completed. Substituted pig script is at " + substFile
                            + ". Expanded pig script is at " + file + ".expanded");
                } else {
                    log.info("Dry run completed. Substituted pig script is at " + substFile);
                }
                return ReturnCode.SUCCESS;
            }

            logFileName = validateLogFile(logFileName, file);
            pigContext.getProperties().setProperty("pig.logfile", (logFileName == null ? "" : logFileName));

            // Set job name based on name of the script
            pigContext.getProperties().setProperty(PigContext.JOB_NAME, "PigOut_" + new File(file).getName());

            if (!debug) {
                new File(substFile).deleteOnExit();
            }

            scriptState.setScript(new File(file));

            // From now on, PigOut starts...
            // Create a shell interface to PigOutServer
            pigOutSh = new PigOutSh(pin, pigContext);
            pigoutCalled = true;

            if (checkScriptOnly) { // -c option
                //Check syntax
                pigOutSh.checkScript(substFile);
                System.err.println(file + " syntax OK");
                return ReturnCode.SUCCESS;
            }

            // parseAndBuild() will parse, and then generate a script
            log.info("PigOut is parsing and analyzing the script...");
            pigOutSh.parseAndBuild();

            log.debug("PigOut is partitioning the plan...");
            pigOutSh.partition();

            return ReturnCode.SUCCESS;
        }
        case STRING: {
            log.error("Please use FILE mode.");
            return -1;
        }
        default:
            break;
        }

    } catch (ParseException e) {
        usage();
        rc = ReturnCode.PARSE_EXCEPTION;
        PigStatsUtil.setErrorMessage(e.getMessage());
        PigStatsUtil.setErrorThrowable(e);
    } catch (org.apache.pig.tools.parameters.ParseException e) {
        // usage();
        rc = ReturnCode.PARSE_EXCEPTION;
        PigStatsUtil.setErrorMessage(e.getMessage());
        PigStatsUtil.setErrorThrowable(e);
    } catch (IOException e) {
        if (e instanceof PigException) {
            PigException pe = (PigException) e;
            rc = (pe.retriable()) ? ReturnCode.RETRIABLE_EXCEPTION : ReturnCode.PIG_EXCEPTION;
            PigStatsUtil.setErrorMessage(pe.getMessage());
            PigStatsUtil.setErrorCode(pe.getErrorCode());
        } else {
            rc = ReturnCode.IO_EXCEPTION;
            PigStatsUtil.setErrorMessage(e.getMessage());
        }
        PigStatsUtil.setErrorThrowable(e);

        if (!pigoutCalled) {
            LogUtils.writeLog(e, logFileName, log, verbose, "Error before Pig is launched");
        }
    } catch (Throwable e) {
        rc = ReturnCode.THROWABLE_EXCEPTION;
        PigStatsUtil.setErrorMessage(e.getMessage());
        PigStatsUtil.setErrorThrowable(e);
        e.printStackTrace();
        if (!pigoutCalled) {
            LogUtils.writeLog(e, logFileName, log, verbose, "Error before Pig is launched");
        }
    } finally {
        // clear temp files
        FileLocalizer.deleteTempFiles();
        PerformanceTimerFactory.getPerfTimerFactory().dumpTimers();
    }

    return rc;

}

From source file:foam.lib.parse.ErrorReportingPStream.java

public String getPrintableCharacter(Character ch) {
    switch ((int) ch) {
    case 0x09://ww  w.j a  va 2 s  . c o  m
        return "\\t";
    case 0x0A:
        return "\\n";
    case 0x0D:
        return "\\r";
    default:
        return ch.toString();
    }
}

From source file:com.salas.bb.utils.StringUtils.java

/**
 * Complete recoding of all HTML entities into Unicode symbols.
 *
 * @param str string./* w  ww.  j a  v a2 s  . c  o m*/
 *
 * @return result.
 */
public static String unescape(String str) {
    if (isEmpty(str))
        return str;

    Pattern p = Pattern.compile("&(([^#;\\s]{3,6})|#([0-9]{1,4})|#x([0-9a-fA-F]{1,4}));");
    Matcher m = p.matcher(str);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
        Character c;

        String strEntity = m.group(2);
        String decEntity = m.group(3);
        String hexEntity = m.group(4);
        if (strEntity != null) {
            // String entity
            c = ENTITIES.get(strEntity);
        } else {
            c = decEntity != null ? (char) Integer.parseInt(decEntity) : (char) Integer.parseInt(hexEntity, 16);
        }

        m.appendReplacement(sb, c == null ? m.group() : c.toString());
    }
    m.appendTail(sb);

    return sb.toString();
}

From source file:com.googlecode.l10nmavenplugin.validators.property.TrailingWhitespaceValidator.java

/**
 * Warn if resource ends with any Java whitespace char (" ", "\t", "\n", ...)
 * //from   w  ww. jav a  2  s  . c  o m
 * @see Character#isWhitespace
 */
public int validate(Property property, List<L10nReportItem> reportItems) {
    String message = property.getMessage();
    if (message.length() > 0) {
        Character tail = message.charAt(message.length() - 1);
        if (Character.isWhitespace(tail)) {
            L10nReportItem reportItem = new L10nReportItem(Type.TRAILING_WHITESPACE,
                    "Resource ends with whitespace character [" + StringEscapeUtils.escapeJava(tail.toString())
                            + "] which may indicate some resources concatenation",
                    property, null);
            reportItems.add(reportItem);
            logger.log(reportItem);
        }
    }
    return 0;
}

From source file:org.gbif.portal.web.tag.AlphabetLinkTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *///from www  .  j a v  a2 s.  c o  m
@Override
public int doStartTag() throws JspException {
    if (letters == null || letters.isEmpty()) {
        return super.doStartTag();
    }

    StringBuffer sb = new StringBuffer();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String contextPath = request.getContextPath();
    List<Character> ignoreChars = new ArrayList<Character>();

    if (StringUtils.isNotEmpty(ignores)) {
        ignores = ignores.trim();
        StringTokenizer st = new StringTokenizer(ignores);
        while (st.hasMoreTokens()) {
            String ignoreChar = st.nextToken();
            if (ignoreChar.length() != 1) {
                throw new JspException("Invalid ignore list :" + ignoreChar);
            }
            ignoreChars.add(new Character(ignoreChar.charAt(0)));
        }
    }

    sb.append("<ul class=\"");
    sb.append(listClass);
    sb.append("\">");
    sb.append("<li class=\"lt\">");

    int indexOfSelected = letters.indexOf(selected);

    if (indexOfSelected > 0) {
        addLink(sb, contextPath, letters.get(indexOfSelected - 1), "&lt;&lt;");
    } else {
        sb.append("&lt;&lt;");
    }
    sb.append("</li>");

    List acceptedChars = Arrays.asList(accepted);
    for (Character letter : letters) {
        if (!ignoreChars.contains(letter) && acceptedChars.contains(letter.toString())) {
            sb.append("<li");
            if (selected != letter) {
                sb.append('>');
                addLink(sb, contextPath, letter);
            } else {
                sb.append(" id=\"chosen\">");
                sb.append(letter);
            }
            sb.append("</li>");
        }
    }

    sb.append("<li class=\"lt\">");

    if (indexOfSelected < (letters.size() - 1)) {
        addLink(sb, contextPath, letters.get(indexOfSelected + 1), "&gt;&gt;");
    } else {
        sb.append("&gt;&gt;");
    }
    sb.append("</li>");
    sb.append("</ul>");

    try {
        pageContext.getOut().write(sb.toString());
    } catch (IOException e) {
        throw new JspException(e);
    }
    return super.doStartTag();
}

From source file:com.seedform.dfatester.viewer.AlphabetListFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    final Character oldChar = mDFA.getAlphabet().get(position);
    final EditText input = new EditText(getActivity());
    input.setHint(getResources().getString(R.string.hint_concat_symbol_replacement) + "\"" + oldChar.toString()
            + "\"");
    input.setGravity(Gravity.CENTER);/*from w w w .  jav a 2  s . c o  m*/
    input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(1) });

    new AlertDialog.Builder(getActivity()).setTitle(R.string.title_symbol_replacement).setView(input)
            .setPositiveButton(R.string.action_replace_symbol, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String inputText = input.getText().toString();
                    String message;

                    if (inputText.length() != 0) {
                        if (mDFA.replaceSymbol(oldChar, inputText.charAt(0))) {
                            message = "\"" + oldChar + "\""
                                    + getResources().getString(R.string.msg_concat_symbol_replaced);
                            mAdapter.notifyDataSetChanged();
                        } else {
                            message = "\"" + inputText + "\""
                                    + getResources().getString(R.string.msg_concat_symbol_exists);
                        }
                        Tool.createToast(getActivity(), message, Toast.LENGTH_SHORT);
                    }
                }
            }).show();
}

From source file:net.sibcolombia.portal.web.tag.AlphabetLinkTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *//*from   ww w .j  a  v  a  2 s.co m*/
@Override
public int doStartTag() throws JspException {
    Locale locale = RequestContextUtils.getLocale((HttpServletRequest) pageContext.getRequest());
    if (letters == null || letters.isEmpty()) {
        return super.doStartTag();
    }

    StringBuffer sb = new StringBuffer();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String contextPath = request.getContextPath();
    List<Character> ignoreChars = new ArrayList<Character>();

    if (StringUtils.isNotEmpty(ignores)) {
        ignores = ignores.trim();
        StringTokenizer st = new StringTokenizer(ignores);
        while (st.hasMoreTokens()) {
            String ignoreChar = st.nextToken();
            if (ignoreChar.length() != 1) {
                throw new JspException("Invalid ignore list :" + ignoreChar);
            }
            ignoreChars.add(new Character(ignoreChar.charAt(0)));
        }
    }

    sb.append("<ul class=\"");
    sb.append(listClass);
    sb.append("\">");
    sb.append("<li class=\"lt\">");

    letters.add(0, '0');
    int indexOfSelected = letters.indexOf(selected);

    if (indexOfSelected > 0) {
        addLink(sb, contextPath, letters.get(indexOfSelected - 1), "&lt;&lt;");
    } else {
        sb.append("&lt;&lt;");
    }
    sb.append("</li>");

    List<String> acceptedChars = Arrays.asList(accepted);
    for (Character letter : letters) {
        if (!ignoreChars.contains(letter) && acceptedChars.contains(letter.toString())) {
            sb.append("<li");
            if (!(letter == '0')) {
                if (selected != letter) {
                    sb.append('>');
                    addLink(sb, contextPath, letter);
                } else {
                    sb.append(" id=\"chosen\">");
                    sb.append(letter);
                }
            } else {
                if (selected != letter) {
                    sb.append('>');
                    addLink(sb, contextPath, '0',
                            messageSource.getMessage("dataset.list.showall", null, "Todas", locale));
                } else {
                    sb.append(" id=\"chosen\">");
                    sb.append(messageSource.getMessage("dataset.list.showall", null, "Todas", locale));
                }
            }
            sb.append("</li>");
        }
    }

    sb.append("<li class=\"lt\">");

    if (indexOfSelected < (letters.size() - 1)) {
        addLink(sb, contextPath, letters.get(indexOfSelected + 1), "&gt;&gt;");
    } else {
        sb.append("&gt;&gt;");
    }
    sb.append("</li>");
    sb.append("</ul>");

    try {
        pageContext.getOut().write(sb.toString());
    } catch (IOException e) {
        throw new JspException(e);
    }
    return super.doStartTag();
}

From source file:ar.com.zauber.commons.gis.street.impl.SQLStreetsDAO.java

/**
 * Escapes a character from a string intended to be used in a like clause.
 * //from   w w  w.j  a v a2 s.  c om
 * @param text string to escape
 * @param escapeChar escape character 
 * @return the escaped string
 */
private String escapeForLike(final String text, final Character escapeChar) {
    String escape = escapeChar.toString();
    return text.replace("%", escape.concat("%")).replace("_", escape.concat("_"));
}