Package org.nutz.lang.segment

Examples of org.nutz.lang.segment.Segment


        assertEquals("-HH-", seg.toString());
    }

    @Test
    public void testAddPP2() {
        Segment seg = Segments.create("-${A}-${B}-");
        seg.add("A", "A");
        seg.add("A", "B");
        seg.add("A", "C");
        seg.add("B", "H");
        seg.add("B", "M");
        assertEquals("-ABC-HM-", seg.toString());
        seg.set("B", "ZZH");
        assertEquals("-ABC-ZZH-", seg.toString());
    }
View Full Code Here


        assertEquals("-ABC-ZZH-", seg.toString());
    }

    @Test
    public void testAddPP3() {
        Segment seg = Segments.create("-${A}-${B}-");
        Segment sub = Segments.create("[${V}]");
        Segment sub2 = Segments.create("%${V}%");
        seg.add("A", sub);
        seg.add("A", sub2);
        seg.set("B", "***");
        sub.set("V", "#");
        sub2.set("V", "@");
        assertEquals("-[#]%@%-***-", seg.toString());
        seg.set("B", "ZZH");
        assertEquals("-[#]%@%-ZZH-", seg.toString());
    }
View Full Code Here

    }

    @Test
    public void testChineseChar() {
        String s = new StringBuilder().append((char) Integer.parseInt("6211", 16)).toString();
        Segment seg = Segments.create(s);
        assertTrue(s.equals(seg.toString()));
    }
View Full Code Here

        Segment seg = Segments.create(s);
        assertTrue(s.equals(seg.toString()));
    }

    public void test_blankKeys() {
        Segment seg = Segments.create("1${A}2${B}3${C}4${D}5");
        // assertEquals(4, seg.blankKeys().size());

        seg.set("A", 34);
        seg.set("D", "GG");
        // assertEquals(2, seg.blankKeys().size());
    }
View Full Code Here

import org.nutz.lang.segment.Segment;

public class CharSegmentTest {
    @Test
    public void testNormal() {
        Segment seg = Segments.create("H${4}B");
        seg.set("4", "zzh");
        assertEquals("H${4}B", seg.getOrginalString());
        assertEquals("HzzhB", seg.toString());
        assertEquals(1, seg.keys().size());
        assertEquals(3, seg.values().size());
    }
View Full Code Here

        assertEquals(3, seg.values().size());
    }

    @Test
    public void testWrongPPname() {
        Segment seg = Segments.create("H${4}B");
        seg.set("RVT", "zzh");
        assertEquals("HB", seg.toString());
        seg.set("4", "zzh");
        assertEquals("HzzhB", seg.toString());
        assertEquals(1, seg.keys().size());
        assertEquals(3, seg.values().size());
    }
View Full Code Here

                    }

                    // 将本地化字符串增加到当前语言
                    for (String key : p.keySet()) {
                        String str = p.get(key);
                        Segment seg = (new CharSegment()).valueOf(str);
                        if (seg.keys().isEmpty())
                            msgs.put(key, str);
                        else
                            msgs.put(key, seg);
                    }
View Full Code Here

TOP

Related Classes of org.nutz.lang.segment.Segment

Copyright © 2018 www.massapicom. 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.