Package java.text

Examples of java.text.StringCharacterIterator.first()


     */
    public String decode( String jcrNodeName ) {
        if (jcrNodeName == null) return null;
        StringBuilder sb = new StringBuilder();
        CharacterIterator iter = new StringCharacterIterator(jcrNodeName);
        for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
            char mapped = c;
            if (c == '\uF02A') {
                mapped = '*';
            } else if (c == '\uF02F') {
                mapped = '/';
View Full Code Here


        String[] parts = classname.split("[\\.]");
        if (parts.length == 0) return false;
        for (String part : parts) {
            CharacterIterator iter = new StringCharacterIterator(part);
            // Check first character (there should at least be one character for each part) ...
            char c = iter.first();
            if (c == CharacterIterator.DONE) return false;
            if (!Character.isJavaIdentifierStart(c) && !Character.isIdentifierIgnorable(c)) return false;
            c = iter.next();
            // Check the remaining characters, if there are any ...
            while (c != CharacterIterator.DONE) {
View Full Code Here

     * @return true if the supplied name is indeed a valid XML Name, or false otherwise
     */
    public static boolean isValidName( String name ) {
        if ( name == null || name.length() == 0 ) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if ( !isValidNameStart(c) ) return false;
        while ( c != CharacterIterator.DONE ) {
            if ( !isValidName(c) ) return false;
            c = iter.next();
        }
View Full Code Here

     * @return true if the supplied name is indeed a valid XML NCName, or false otherwise
     */
    public static boolean isValidNcName( String name ) {
        if ( name == null || name.length() == 0 ) return false;
        CharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if ( !isValidNcNameStart(c) ) return false;
        while ( c != CharacterIterator.DONE ) {
            if ( !isValidNcName(c) ) return false;
            c = iter.next();
        }
View Full Code Here

        if (text == null) return null;
        if (text.length() == 0) return text;
        final BitSet safeChars = isSlashEncoded() ? RFC2396_UNRESERVED_CHARACTERS : RFC2396_UNRESERVED_WITH_SLASH_CHARACTERS;
        final StringBuilder result = new StringBuilder();
        final CharacterIterator iter = new StringCharacterIterator(text);
        for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
            if (safeChars.get(c)) {
                // Safe character, so just pass through ...
                result.append(c);
            } else {
                // The character is not a safe character, and must be escaped ...
View Full Code Here

    public String decode( String encodedText ) {
        if (encodedText == null) return null;
        if (encodedText.length() == 0) return encodedText;
        final StringBuilder result = new StringBuilder();
        final CharacterIterator iter = new StringCharacterIterator(encodedText);
        for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
            if (c == ESCAPE_CHARACTER) {
                boolean foundEscapedCharacter = false;
                // Found the first character in a potential escape sequence, so grab the next two characters ...
                char hexChar1 = iter.next();
                char hexChar2 = hexChar1 != CharacterIterator.DONE ? iter.next() : CharacterIterator.DONE;
View Full Code Here

    protected void string(Object obj) {
        this.add('"');

        CharacterIterator it = new StringCharacterIterator(obj.toString());

        for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {
            if (c == '"') {
                this.add("\\\"");
            } else if (c == '\\') {
                this.add("\\\\");
            } else if (c == '/') {
View Full Code Here

    CharacterIterator iterator = new StringCharacterIterator (name);

    // Count how many words there are in the string.
    int count = 0;
    char lastChar = 'a';
    for (char c = iterator.first (); c != CharacterIterator.DONE;
         c = iterator.next ()) {

      if ((Character.isUpperCase (c) || Character.isDigit(c))
     && !(Character.isUpperCase(lastChar) ||
    Character.isDigit(lastChar))) {
View Full Code Here

    String [] words = new String [count];
    count = 0;
    int begin = 0;
    int end;
    lastChar = 'a';
    for (char c = iterator.first (); c != CharacterIterator.DONE;
         c = iterator.next ()) {


      if ((Character.isUpperCase (c) || Character.isDigit(c))
     && !(Character.isUpperCase(lastChar) ||
View Full Code Here

      uri= uri.substring(1);
    }

    StringBuffer sb= new StringBuffer();
    CharacterIterator iter= new StringCharacterIterator(uri);
    for(char c= iter.first(); c != CharacterIterator.DONE; c= iter.next()) {
      if(c == '%') {
        char c1= iter.next();
        if(c1 != CharacterIterator.DONE) {
          int i1= Character.digit(c1, 16);
          char c2= iter.next();
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.