Package java.text

Examples of java.text.StringCharacterIterator.current()


        buf.append( mWordDelim );
        buf.append( Character.toLowerCase( firstOfNext ) );
      }
     
      buf.append( getLowerCaseSequence( iter ) );
      if ( iter.current() != CharacterIterator.DONE )
      {
        buf.append( mWordDelim );
      }
    }
   
View Full Code Here


  private static String checkforRegex(String aRegexFragment) {
    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

  private static String checkforRegex(String aRegexFragment) {
    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

    */
   public static String truncate(int maxChars, String s) {
      if (maxChars < 0 || s == null || s.length() <= maxChars)
         return s;
      StringCharacterIterator stringIterator = new StringCharacterIterator(s, maxChars);
      for (char c = stringIterator.current(); c != CharacterIterator.DONE; c = stringIterator.previous()) {
         if (!Character.isLetterOrDigit(c)) {
            return s.substring(0, stringIterator.getIndex());
         }
      }
      // we didn't find a non-LetterOrDigit character prior to maxChars
View Full Code Here

  */
  public static String forHTMLTag(String aTagFragment){
    final StringBuffer result = new StringBuffer();

    final StringCharacterIterator iterator = new StringCharacterIterator(aTagFragment);
    char character =  iterator.current();
    while (character != CharacterIterator.DONE ){
      if (character == '<') {
        result.append("&lt;");
      }
      else if (character == '>') {
View Full Code Here

  * character which appears in a character entity.
  */
  public static String toDisableTags(String aText){
    final StringBuffer result = new StringBuffer();
    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

  */
  public static String forRegex(String aRegexFragment){
    final StringBuffer result = new StringBuffer();

    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

   */
  public static String forJavaCode(String codeFragment) {
      final StringBuffer result = new StringBuffer();

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

{

    public static String decode(String source) throws IllegalArgumentException {
        StringBuffer result = new StringBuffer();
        StringCharacterIterator sci = new StringCharacterIterator(source);
        for (char c = sci.current(); c != CharacterIterator.DONE; c = sci.next()) {
            if (c == '$') {
                c = sci.next();
                if (c != CharacterIterator.DONE) {
                    if (c == '$') {
                        result.append('$');
View Full Code Here

        if (source == null) {
            return "$e";
        }
        StringBuffer result = new StringBuffer();
        StringCharacterIterator sci = new StringCharacterIterator(source);
        for (char c = sci.current(); c != CharacterIterator.DONE; c = sci.next()) {
            if (c == '$') {
                result.append("$$");
            }
            else if (c == ',') {
                result.append("$k");
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.