File: Format

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (55 lines) | stat: -rw-r--r-- 1,167 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// value1 is 32.5678. 
value1 = 32.5678;



// The following will output the string "number = 32.567799" 
output = Format("number = %f", value1);
Echo(output);



// The following will output the string "number = 32.57"
output = Format("number = %3.2f", value1);
Echo(output);



// The following will output the string "number =       32.57"
output = Format("number = %11.2f", value1);
Echo(output);



// value2 is 134569891.45
// value3 is "New York"
value2 = 134569891.45;
value3 = "New York";


 
// The following will output the string 
//     "number = 134569888.000000, state = New York"
output = Format("number = %f, state = %s", value2, value3);
Echo(output);



// The following will output the string "number =  134569888, state = New York"
output = Format("number = %10.0f, state = %s", value2, value3);
Echo(output);



// The following will output the string "number = 1.3457e+08, state = New York"
output = Format("number = %g, state = %s", value2, value3);
Echo(output);



// The following will output the string 
//     "number = 1.3457e+08, state =        New York"   
output = Format("number = %g, state = %15s", value2, value3);
Echo(output);