Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4398693

please add String.isJavaIdentifier

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 1.4.0
    • core-libs
    • None
    • generic
    • solaris_7

      It seems strange to have the methods
      Character.isJavaIdentifierStart
      and
      Character.isJavaIdentifierPart
      and yet there is no method
      String.isJavaIdentifier

      which would look something like this

          public boolean isJavaIdentifier() {
            int n = length();
            if (n==0) return false;
            if (!Character.isJavaIdentifierStart(charAt(0)))
                return false;
            for (int i = 1; i < n; i++)
                if (!Character.isJavaIdentifierPart(charAt(i)))
                    return false;
            return true;
          }

            joconnersunw John Oconner (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: