replace() private method

private replace ( int par0, int par1, global par2 ) : global::java.lang.StringBuilder
par0 int
par1 int
par2 global
return global::java.lang.StringBuilder
Ejemplo n.º 1
0
        private String inputDigitHelper(char nextChar)
        {
            Matcher digitMatcher = DIGIT_PATTERN.matcher(formattingTemplate);

            if (digitMatcher.find(lastMatchPosition))
            {
                String tempTemplate = digitMatcher.replaceFirst(Character.toString(nextChar));
                formattingTemplate.replace(0, tempTemplate.length(), tempTemplate);
                lastMatchPosition = digitMatcher.start();
                return(formattingTemplate.substring(0, lastMatchPosition + 1));
            }
            else
            {
                if (possibleFormats.size() == 1)
                {
                    // More digits are entered than we could handle, and there are no other valid patterns to
                    // try.
                    ableToFormat = false;
                } // else, we just reset the formatting pattern.
                currentFormattingPattern = "";
                return(accruedInput.toString());
            }
        }