Package java.text

Examples of java.text.StringCharacterIterator.current()


  {
    final StringBuffer result = new StringBuffer();

    final StringCharacterIterator iterator = new StringCharacterIterator(
        aRegexFragment);
    char character = iterator.current();
    while (character != StringCharacterIterator.DONE)
    {
      /*
       * All literals need to have backslashes doubled.
       */
 
View Full Code Here


         */

        final CharacterIterator ci = new StringCharacterIterator(commandLine.toString());

        String event;
        char c = ci.current();
        if (c == '!') {
            c = ci.next();
            if (c == '!') {
                event = this.commands.getLast();
                ci.next();
View Full Code Here

            event = subst(ci, c, false, this.commands.getLast());
        } else {
            throw new IllegalArgumentException(commandLine + ": Unsupported event");
        }

        if (ci.current() == ':') {
            c = ci.next();
            boolean global = (c == 'a' || c == 'g');
            if (global) {
                c = ci.next();
            }
View Full Code Here

        StringBuffer sb = new StringBuffer();
        StringCharacterIterator it = new StringCharacterIterator(s);
        for (int i = 0; i < it.getEndIndex(); i++)
        {
            it.setIndex(i);
            char c = it.current();
            String escaped = (String) charToEscape.get(new Character(c).toString());
            if (escaped != null)
            {
                sb.append(escaped);
            } else
View Full Code Here

   
  public static String escape(String aRegexFragment){
    final StringBuilder result = new StringBuilder();
   
    final StringCharacterIterator iterator = new StringCharacterIterator(aRegexFragment);
    char character =  iterator.current();
    while (character != CharacterIterator.DONE ){
      if (character == '.') {
        result.append("\\.");
      }
      else if (character == '\\') {
View Full Code Here

    five</em> of the above characters.
   */
   public static String forHTML(String aText){
     final StringBuilder result = new StringBuilder();
     final StringCharacterIterator iterator = new StringCharacterIterator(aText);
     char character =  iterator.current();
     while (character != CharacterIterator.DONE ){
       if (character == '<') {
         result.append("&lt;");
       }
       else if (character == '>') {
View Full Code Here

    HTML.</span>
  */
  public static String forXML(String aText){
    final StringBuilder result = new StringBuilder();
    final StringCharacterIterator iterator = new StringCharacterIterator(aText);
    char character =  iterator.current();
    while (character != CharacterIterator.DONE ){
      if (character == '<') {
        result.append("&lt;");
      }
      else if (character == '>') {
View Full Code Here

   <P>See <a href='http://www.ietf.org/rfc/rfc4627.txt'>RFC 4627</a> for more information.
  */
  public static String forJSON(String aText){
    final StringBuilder result = new StringBuilder();
    StringCharacterIterator iterator = new StringCharacterIterator(aText);
    char character = iterator.current();
    while (character != StringCharacterIterator.DONE){
      if( character == '\"' ){
        result.append("\\\"");
      }
      else if(character == '\\'){
View Full Code Here

   replaced by their escaped equivalents.
  */
  public static String toDisableTags(String aText){
    final StringBuilder result = new StringBuilder();
    final StringCharacterIterator iterator = new StringCharacterIterator(aText);
    char character =  iterator.current();
    while (character != CharacterIterator.DONE ){
      if (character == '<') {
        result.append("&lt;");
      }
      else if (character == '>') {
View Full Code Here

    final StringBuilder result = new StringBuilder();

    final StringCharacterIterator iterator =
      new StringCharacterIterator(aRegexFragment)
    ;
    char character =  iterator.current();
    while (character != CharacterIterator.DONE ){
      /*
       All literals need to have backslashes doubled.
      */
      if (character == '.') {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.