[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Numeric Formatting with Put

SparForte offers numeric formatting for numbers up to 18 digits and 4 decimal places. Formatted numbers are written with the put command, not put_line. Following the number, provide a formatting picture string describing how the number should be formatted.

The picture string may include:

  • '+' - the number will be printed with a leading + or -
  • '-' - a negative numbers will be printed with a leading -
  • '<' and '>' - a negative number will be printed with (..)
  • "CR" - a negative number will be printed with a leading "CR" (credit)
  • "DB" - a negative number will be printed with a leading "DB" (debit)
  • '$' - the currency symbol will be printed, or a floating dollar sign if multiple instances
  • '.' - marks the actual position for a decimal point
  • 'V' - marks the assumed position for a decimal point
  • '9' - space for a number with leading zeros
  • '#' - same as '$', except only the leading character is shown
  • 'Z' - space for a numbers with leading blanks
  • '_', 'B', '0', '/'- inserted. 'B' is a blank
  • '*' - space for a number with leading asterisks

Here are a few examples.

=> put( 12.34, "***9.99" ) ; new_line
**12.34
=> put( 12.34, "###9.99" ) ; new_line
 $12.34
=> put( 12.34, "+###9.99" ) ; new_line
+ $12.34
=> put( 12.34, "-###9.99" ) ; new_line
  $12.34
=> put( 12.34, "<###9.99>" ) ; new_line
  $12.34
=> put( -12.34, "<###9.99>" ) ; new_line
( $12.34)
 

Example: Hello World
[Right Submenu]

 AdaScript versus GCC

 Case Sensitivity

 Reserved Words

 Comments

 Literals

 Bourne Shell Word Expansions

 Fundamental Types

 User-defined Types

 Enumerated Types

 Arrays

 Records

 Basic Assignment

 The @ and % Operands

 Command Argument Shortcuts

 Redirection and Pipelines

 Command Line Interaction

 Built-in Shell Commands

 The Current Directory

 Database Commands

 Flow of Control

 Other Statements/ Subprograms

 External Commands

 Block Statements and Subprograms

 TCP/IP Sockets

 Numeric Formatting with Put

 Interpreter Directives

 Command Line Options

 Command Reference

 ASCII and Latin_1 Character Sets

 Common Error Messages

 Common PHP Functions and the SparForte Equivalent

[Back to Top] Back To Top [Small Forte Symbol]