Wiki

root/cobra/trunk/Tests/100-basics/062j-string-substitution-fmt.cobra

Revision 2631, 0.6 KB (checked in by Charles.Esterbrook, 5 months ago)

JVM back-end progress.
credit:hopscc

  • Property svn:eol-style set to native
Line 
1#.require. jvm
2# some simple string subst formatting tests - java format descriptions
3namespace Test
4
5    class Test
6
7        def main
8            is shared
9
10            # formatting
11            #mol as float = 42.0
12            #print '[mol:%.2d]'
13            ## TODO This not yet working as formatting on makeString in java version NYI
14            #assert '[mol:%.2d]'=='42.00'
15       
16            a = 99
17            # test some using format substitution without the escape syntax.
18            t = String.format('a = %0$s[a]]', c'[')
19            assert t == r'a = [99]'
20           
21            s10 = 'FMT:a = '+ ns'[' +'[a]]'
22            assert s10 == r'FMT:a = [99]'
23   
24            a1 = String.format('%0$s[a]]', ns'[')
25            s11 = 'a = [a1]'
26            assert s11 == r'a = [99]'
27   
28           
29           
Note: See TracBrowser for help on using the browser.