Package org.eobjects.analyzer.util

Examples of org.eobjects.analyzer.util.CharIterator


  public static String safeName(String str) {
    if (StringUtils.isNullOrEmpty(str)) {
      throw new IllegalArgumentException("Cannot create safe name from empty/null string: " + str);
    }

    CharIterator ci = new CharIterator(str);
    while (ci.hasNext()) {
      ci.next();
      if (!ci.isLetter() && !ci.isDigit()) {
        // replaces unexpected chars with underscore
        ci.set('_');
      }
    }

    str = ci.toString();
    if (!Character.isLetter(str.charAt(0))) {
      str = "db" + str;
    }
    return str;
  }
View Full Code Here


  private static final long serialVersionUID = 1L;

  @Override
  public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
    boolean number = true;
    CharIterator it = new CharIterator(str);
    while (it.hasNext() && number) {
      it.next();
      if (!it.isDigit()) {
        if (!it.is('-')) {
          if (!it.is('.')) {
            if (!it.is('%')) {
              number = false;
            }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.eobjects.analyzer.util.CharIterator

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.