As
<pageheader><i>varname</i> As <i>type / format</i></pageheader>
The As operator performs two functions - conversion and formatting.
Conversion: varname As type
Converts the variable varname to the specified type. Valid types are:
When converting from a string to a date, valid input formats are:
YYYY-MM-DD
YYYY-MM-DD HH:MM:SS
HH:MM:SS
Times must be in 24-hour format, minutes and seconds are optional. If a time is specified on its own, today's date is assumed.
Formatting: varname As format
Formats the variable varname using the specified formatting code.
Various formatting operations are available.
File size values using the codes shown below
Zero-padding to p places using #p or %0p
Right-justify to p places using %p
Left-justify to p places using %-p
Internal-justify:
For negative numbers to p places using %_p
For positive numbers %+p
Limit to p decimal places using %.p
Zero-pad to p decimal places with %.0p
Convert to hexadecimal using %x (lowercase) or %X (uppercase)
Where it makes sense the above codes can be combined, e.g. %_+8 would internal-justify a number to 8 places whether it was positive or negative.
File size format
Use value as size to automatically format a number as a file size using the default settings. You can also use the following keywords to control the units:
You use %.x to specify the number of decimal places, e.g. %.3mib. or %.03kb to zero-pad
Use %^ to round up to the nearest kilobyte, e.g. %^kb.
Use %0 in front of the "automatic" keywords to force 0 bytes to be formatted as kilobytes
最后更新于