Package java.text

Examples of java.text.StringCharacterIterator.first()


        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


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

     */
    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

        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

  int copyTo = 0;
  // it will always be less than the original
  char[] chars = new char[original.length()];
  StringCharacterIterator iter = new StringCharacterIterator(original);
 
  for(char c = iter.first(); c != CharacterIterator.DONE;
      c = iter.next()) {

      if (c == '&') {
    changedString = true;
    copyTo = base64decode(chars, copyTo, iter);
View Full Code Here

    // FIXME (SM): this method may be a hotspot for requests with many
    //             parameters we should try to optimize it further
    static boolean isValidXSLTParameterName(String name) {
        StringCharacterIterator iter = new StringCharacterIterator(name);
        char c = iter.first();
        if (!(Character.isLetter(c) || c == '_')) {
            return false;
        } else {
            c = iter.next();
        }
View Full Code Here

        StringBuffer bs = new StringBuffer(to_process.length() + 50);
        StringCharacterIterator sci = new StringCharacterIterator(to_process);
        String tmp = null;

        for (char c = sci.first(); c != CharacterIterator.DONE; c = sci.next())
        {
            tmp = String.valueOf(c);

            if (hasAttribute(tmp))
                tmp = (String) this.get(tmp);
View Full Code Here

        StringBuffer sb = new StringBuffer(to_split.length()+50);
        StringCharacterIterator sci = new StringCharacterIterator(to_split);
        int length = 0;

        for (char c = sci.first(); c != CharacterIterator.DONE; c = sci.next())
        {
            if(String.valueOf(c).equals(" "))
                length++;
            else if(sci.getEndIndex()-1 == sci.getIndex())
                length++;
View Full Code Here

        }

        String[] array = new String[length];
        length = 0;
        String tmp = new String();
        for (char c = sci.first(); c!= CharacterIterator.DONE; c = sci.next())
        {
            if(String.valueOf(c).equals(" "))
            {
                array[length] = tmp;
                tmp = new String();
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.