Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Conversion
  %ascii
  %char
  %crtonl
  %lower
  %nltocr
  %number
  %proper
  %quote
  %repeat
  %string
  %stripansi
  %stripq
  %upper
Function Reference
  %abs
  %additem
  %addkey
  %alarm
  %alias
  %ansi
  %array
  %arrget
  %arrhigh
  %arrset
  %ascii
  %average
  %begins
  %bitand
  %bitnot
  %bitor
  %bitxor
  %btncol
  %btnenable
  %btnimage
  %case
  %char
  %charcomment
  %charnotes
  %class
  %clip
  %color
  %colorname
  %comactive
  %comcreate
  %comget
  %comset
  %concat
  %copy
  %count
  %countlist
  %crtonl
  %db
  %dbget
  %dblist
  %dbmax
  %dbmin
  %dde
  %ddeclose
  %ddemacro
  %ddeopen
  %ddepoke
  %defined
  %delete
  %delitem
  %delkey
  %delnitem
  %destroom
  %dice
  %diceavg
  %dicedev
  %dicemax
  %dicemin
  %doorname
  %dups
  %ends
  %eval
  %exec
  %expand
  %expanddb
  %expandlist
  %filesize
  %find
  %float
  %format
  %getglobal
  %grep
  %gsl
  %handle
  %if
  %insert
  %int
  %inwalk
  %isfloat
  %iskey
  %ismember
  %isnumber
  %item
  %lastdir
  %left
  %leftback
  %len
  %literal
  %look
  %lower
  %match
  %mapfilter
  %maplocked
  %mapquery
  %mapvnum
  %max
  %mcp
  %min
  %mod
  %mss
  %nextdir
  %nltocr
  %norm
  %null
  %number
  %numbuttons
  %numitems
  %numkeys
  %numparam
  %numrec
  %numrooms
  %numwords
  %numzones
  %param
  %parsemode
  %pathcompress
  %pathexpand
  %pathfrom
  %pathreverse
  %pick
  %pop
  %portal
  %portalenabled
  %pos
  %prompt
  %proper
  %push
  %query
  %quote
  %random
  %read
  %regex
  %remove
  %repeat
  %replace
  %replaceitem
  %reversedir
  %right
  %rightback
  %roomcol
  %roomcom
  %roomcontents
  %roomcost
  %roomdesc
  %roomexit
  %roomflags
  %roomid
  %roomkey
  %roomkind
  %roomlink
  %roomload
  %roommob
  %roommode
  %roomname
  %roomnote
  %roomnum
  %roomobj
  %roomportal
  %roomvnum
  %roomzone
  %round
  %setglobal
  %sort
  %sqrt
  %state
  %stdev
  %string
  %stripansi
  %stripq
  %subchar
  %subregex
  %sum
  %time
  %trigger
  %trim
  %trimleft
  %trimright
  %upper
  %viewrec
  %walk
  %walkactive
  %walkconfirm
  %walkmode
  %walkroom
  %window
  %word
  %write
  %yesno
  %zonename
  %zonenum
  %zonevnum
Related Links:
  Folder Interface
  Setting up the automapper.
  Basic Usage
  Introduction to Buttons
  Introduction to the Database
  Creating a Database
  Adding Data to a Database
  Database Variables
  User Interface
  Pretty Printing
  Trigger States
  Menu Reference
  #ALARM
  #COLOR
  #CW
  #DBPUT
  #FIND
  #MAKEWINDOW
  #PCOL
  #PICK
  #SHOW
  #TAG
  #VIEW
  Function Reference
  %colorname
  %dbget
  %dice
  %diceavg
  %dicedev
  %dicemax
  %dicemin
  %format
  %roomcol
  %roomflags
  %time
  Trigger Command Options
  Predefined Variables
  Comparison with .NET
  Core Concepts
  WideString
  Image
  Label
  Edit
  Flags
  Headers
  RawMessage
  Attachment
  NewFolder
  NewMessage
  Format
  Color
  ReadIni
  WriteIni
  DiceStr
  ContentType
  Editor Demo
  Tutorial - Web browser (Part 1)
  Filter
  Properties
  ShowRGB
  Events
  ToString
  DateFormat
  OnFileChange
  SaveToFile
  LoadFromFile
  ExportXML
  Template
  ImportXML
  OptionExists
  OptionValue
  Status of new features for CMUD
  zExplorer Manual
  Packages
  %colorname
  %dbget
  Conversion
  %dice
  %diceavg
  %dicedev
  %dicemax
  %dicemin
  %format
  %roomcol
  %roomflags
  %time
  #ALARM
  #COLOR
  #CW
  #DBPUT
  #FIND
  #MAKEWINDOW
  #PCOL
  #PICK
  #SHOW
  #TAG
  #VIEW
  Miscellaneous
  Database
  Introduction to Buttons
  Basic Usage
  Predefined Variables
  Database Module
  Creating a Database
  Adding Data to a Database
  Database Variables
  Command line
  Searching
  8: Writing Functions
  Timestamps
  Multistate triggers
  Advanced subregex
  Whats new in v3
  New commands
  %hexcolor
  #SQLDB
  #SENDGMCP
  %json
  %url
  New Mapper
  Stringlists / Tables
  GMCP Support
  GMCP Protocol
%format [[%format]] 
format

Syntax: %format(f,a,b,c,d...)

Use a format string to format the values of a,b,c, etc. Format strings consist of a string of characters, with special format specifiers of the type &w.dx where w is the width of the field, d is the number of decimal places, and x is the format type.

Valid format types:

e: scientific notation(full format)
f: floting point (defaults to 2 decimal places)
g: scientific notation(abbreviated)
m: money (defaults to 2 decimal places)
n: number (commas every 3 digits, defaults to 2 decimal places)
s: string
d: integer (decimal). Same as n but without the commas

You can also use the syntax %format(n,x) to format a floating point number x with only n decimal points.

Special width modifier - switches from right justification to left.

Any error in the format parameters will cause format to return null.

Examples:

<NOBR> #SHOW %format("&10.0n",123456)</NOBR>
will display 123,456 with 3 spaces padding the front

#SHOW %format("&3.0f &s",123,"coins")
will display '123 coins'

#SHOW %format(2,1.23456)
displays 1.23
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net