Examples of parseToMap()


Examples of com.ibm.icu.text.MessageFormat.parseToMap()

            String tempBuffer = messageFormatter.format(paramsMap);
            if (!tempBuffer.equals("Impossible {arg1} has occurred -- status code is 7 and message is {arg2}."))
                errln("Tests arguments < substitution failed");
            logln("Formatted with 7 : " + tempBuffer);
            ParsePosition status = new ParsePosition(0);
            Map objs = messageFormatter.parseToMap(tempBuffer, status);
            if (objs.get("arg1") != null || objs.get("arg2") != null)
                errln("Parse failed with more than expected arguments");
            for (Iterator keyIter = objs.keySet().iterator();
                 keyIter.hasNext();) {
                String key = (String) keyIter.next();
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        if (pos.getErrorIndex() != -1) {
            errln("ParsePosition.getErrorIndex initialization failed.");
        }
        MessageFormat fmt = new MessageFormat("There are {numberOfApples} apples growing on the {whatKindOfTree} tree.");
        String str = new String("There is one apple growing on the peach tree.");
        Map objs = fmt.parseToMap(str, pos);
        logln("unparsable string , should fail at " + pos.getErrorIndex());
        if (pos.getErrorIndex() == -1)
            errln("Bug 4052223 failed : parsing string " + str);
        pos.setErrorIndex(4);
        if (pos.getErrorIndex() != 4)
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        for (int i = 0; i < patterns.length; i++) {
            String pattern = patterns[i];
            mf.applyPattern(pattern);
            try {
                Map objs = mf.parseToMap(null, new ParsePosition(0));
                logln("pattern: \"" + pattern + "\"");
                log(" parsedObjects: ");
                if (objs != null) {
                    log("{");
                    for (Iterator keyIter = objs.keySet().iterator();
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        }
    }{ // Taken from Test4118594().
        String argName = "something_stupid";
        MessageFormat mf = new MessageFormat("{"+ argName + "}, {" + argName + "}, {" + argName + "}");
        String forParsing = "x, y, z";
        Map objs = mf.parseToMap(forParsing, new ParsePosition(0));
        logln("pattern: \"" + mf.toPattern() + "\"");
        logln("text for parsing: \"" + forParsing + "\"");
        if (!objs.get(argName).toString().equals("z"))
            errln("argument0: \"" + objs.get(argName) + "\"");
        mf.setLocale(Locale.US);
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        logln("pattern: \"" + mf.toPattern() + "\"");
        logln("text for parsing: \"" + result + "\"");
        // result now equals "3.14, 3.1"
        if (!result.equals("3.14, 3.1"))
            errln("result = " + result);
        Map newobjs = mf.parseToMap(result, new ParsePosition(0));
        // newobjs now equals {new Double(3.1)}
        if (((Number)newobjs.get(argName)).doubleValue() != 3.1) // was (Double) [alan]
            errln( "newobjs.get(argName) = " + newobjs.get(argName));
    }{ // Taken from Test4105380().
        String patternText1 = "The disk \"{diskName}\" contains {numberOfFiles}.";
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        String msgFormatString = "{foo} =sep= {bar}";
        MessageFormat msg = new MessageFormat(msgFormatString);
        String source = "abc =sep= def";

        try {
            Map fmt_map = msg.parseToMap(source);
            if (fmt_map.keySet().size() != 2) {
                errln("*** MSG parse (ustring, count, err) count err.");
            } else {
                assertEquals("parse()[0]", "abc", fmt_map.get("foo"));
                assertEquals("parse()[1]", "def", fmt_map.get("bar"));
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        } catch (ParseException e1) {
            errln("*** MSG parse (ustring, count, err) error.");
        }

        ParsePosition pp = new ParsePosition(0);
        Map fmt_map = msg.parseToMap(source, pp);
        if (pp.getIndex()==0 || fmt_map==null) {
            errln("*** MSG parse (ustring, parsepos., count) error.");
        } else {
            if (fmt_map.keySet().size() != 2) {
                errln("*** MSG parse (ustring, parsepos., count) count err.");
View Full Code Here

Examples of com.ibm.icu.text.MessageFormat.parseToMap()

        if (!target.equals(result)) {
            errln("expected '" + target + "' but got '" + result + "'");
        }

        try {
            Map mapResult = mf.parseToMap(target);
            if (!map12.equals(mapResult)) {
                errln("expected " + map12 + " but got " + mapResult);
            }
        } catch (ParseException e) {
            errln("unexpected exception: " + e.getMessage());
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.