| Previous | Contents | Index |
The less than sign left-justifies text within a field. The less than sign must appear at the beginning of a field. The less than sign counts as a character position. In this example, justification occurs only in the second field.
| Example 7-23 < character in PRINT USING |
|---|
print using "#### <###": 'Test', 'Hi'
print '123456789'
end
Test Hi
123456789
|
In the above example, there are two fields. When the first string is printed, the word "Test" occupies all four character positions. The less than sign (<) causes Sheerpower to left-justify the second expression.
The greater than sign is used to right-justify text within a field. The greater than sign must appear at the beginning of a field. The greater than sign counts as a character position.
| Example 7-24 > character in PRINT USING |
|---|
print using "#### >###": 'Test', 'Hi'
print '123456789'
end
Test Hi
123456789
|
In the above example, there are two fields. The greater than sign (>) causes Sheerpower to right-justify the second expression.
The @ indicates one character position with no translation.
| Example 7-25 @ character in PRINT USING |
|---|
print using '####': 0001
print using '@@@@': 0001
end
1
0001
|
You can include a decimal point in a number by putting a period or decimal point in the format.
| Example 7-26 . character in PRINT USING |
|---|
print using "###.##": 19.3
end
19.30
|
Include commas in your numbers by putting commas in the format.
| Example 7-27 , character in PRINT USING |
|---|
a$ = "##,###.##"
print using a$: 28290.06
print using a$: 8290.06
print using a$: 290.06
end
28,290.06
8,290.06
290.06
|
Commas cannot be used in exponential format.
The % character pads on the left with zeros.
| Example 7-28 % character in PRINT USING |
|---|
print '-1- -2- -3-'
print using "%%% %%% %%%": 193, 19, 1
end
-1- -2- -3-
193 019 001
|
The * character pads on the left with asterisks. This symbol can be used to set up check amounts.
| Example 7-29 * character in PRINT USING |
|---|
print using '***,***.**': 19.42
end
*****19.42
|
If the expression is smaller than the format, Sheerpower will right justify the expression and pad it with asterisks.
| Example 7-30 * character in PRINT USING |
|---|
print '-1- -2- -3-'
print using "*** *** ***": 193, 19, 1
end
-1- -2- -3-
193 *19 **1
|
A plus sign causes Sheerpower to print a leading plus or minus sign. Sheerpower will print a plus sign in front of positive numbers and a minus sign in front of negative numbers.
The "+" sign adds a character position to the format. The character position is used for the sign of the number.
| Example 7-31 + character in PRINT USING |
|---|
print ' -1- -2- -3-'
print using "+### +### +###": 193, 19, -1
end
-1- -2- -3-
+193 +19 -1
|
The - character prints a leading or trailing minus sign for negative numbers, and a leading space for positive numbers. The "-" adds a character position to the format. The character position is used to print the minus sign or space.
| Example 7-32 - character in PRINT USING |
|---|
print ' -1- -2- -3-'
print using "-### -### -###": 193, 19, -1
end
-1- -2- -3-
193 19 -1
|
The ~ (tilde) character marks the character following it as literal data.
| Example 7-33 ~ character in PRINT USING |
|---|
print using '###~-###~-####': '5556667777'
end
555-666-7777
|
The $ character prints a floating dollar sign. The dollar sign appears before the number. $ causes Sheerpower to print '$-' for negative numbers and '$' for positive numbers. The minus sign appears immediately after the dollar sign and before the number.
| Example 7-34 $ character in PRINT USING |
|---|
print "1st col 2nd col"
print using "$###.## $###.##": 11.93, -1.93
end
1st col 2nd col
$11.93 $-1.93
|
$+ characters print a floating dollar sign. The dollar sign appears before the numeric expression. $+ causes Sheerpower to print a minus sign before negative numbers, and a plus sign before positive numbers. The sign appears after the dollar sign and before the number.
| Example 7-35 $+ characters in PRINT USING |
|---|
print "1st col 2nd col"
print using "$+###.## $+###.##": 11.93, -1.93
end
1st col 2nd col
$+11.93 $-1.93
|
-$ characters print a floating dollar sign. The dollar sign appears immediately before the numeric expression. -$ causes Sheerpower to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears immediately before the dollar sign.
| Example 7-36 -$ characters in PRINT USING |
|---|
print "1st col 2nd col"
print using "-$###.## -$###.##": 11.93, -1.93
end
1st col 2nd col
$11.93 -$1.93
|
+$ causes Sheerpower to print a floating dollar sign. The dollar sign appears immediately before the number. +$ causes Sheerpower to print a plus sign before positive numbers and a minus sign before negative numbers. The plus or minus sign appears immediately before the dollar sign.
| Example 7-37 +$ characters in PRINT USING |
|---|
print "1st col 2nd col"
print using "+$###.## +$###.##": 11.93, -1.93
end
1st col 2nd col
+$11.93 -$1.93
|
Notice that +$ adds two character positions to the format. One position contains the dollar sign, the other contains the plus or minus sign.
$- characters prints a floating dollar sign. The dollar sign appears before the number. $- causes Sheerpower to print a minus sign before negative numbers and a space before positive numbers. The minus sign or space appears after the dollar sign and before the number.
| Example 7-38 $- characters in PRINT USING |
|---|
print "1st col 2nd col"
print using "$-###.## $-###.##": 11.93, -1.93
end
1st col 2nd col
$ 11.93 $-1.93
|
If your expression is too large to fit in a field, Sheerpower gives an exception.
The directives used with the USING option of the PRINT statement tell Sheerpower what to do with the text.
PRINT USING 'directive' : str_expr
|
The UCASE directive converts the str_expr to uppercase characters.
| Example 7-39 UCASE Directive Used with PRINT USING |
|---|
print using '{ucase}?' : 'march'
end
MARCH
|
The LCASE directive converts the str_expr to lowercase characters.
| Example 7-40 LCASE Directive Used with PRINT USING |
|---|
print using '{lcase}?' : 'MARCH'
end
march
|
The HYPHEN directive causes Sheerpower to suppress the hyphen character if it is the last non-blank character after the format is applied.
| Example 7-41 HYPHEN Directive Used with PRINT USING |
|---|
print using '<#####~-####' : '92123'
print using '{hyphen}<#####~-####' : '92123'
end
92123 -
92123
|
| Previous | Next | Contents | Index |