Files
harbour-core/doc/en/transfrm.txt
Viktor Szakats 03ac58b17b 2017-09-08 18:22 UTC Viktor Szakats (vszakats users.noreply.github.com)
* bin/commit.hb
  * config/detect.mk
  * config/detfun.mk
  * config/detplat.mk
  * config/dir.mk
  * config/dirsh.mk
  * config/global.mk
  * config/globsh.mk
  * config/instsh.mk
  * config/lang.hb
  * config/lang2po.hb
  * config/po2lang.hb
  * config/postinst.hb
  * contrib/hbexpat/tests/tohash.prg
  * contrib/hbformat/utils/hbformat.ini
  * contrib/hbmisc/hbedit.prg
  * contrib/hbmxml/tests/testmxml.prg
  * contrib/hbnetio/utils/hbnetio/_console.prg
  * contrib/hbnetio/utils/hbnetio/_winsvc.prg
  * contrib/hbnetio/utils/hbnetio/hbnetio.prg
  * contrib/hbnetio/utils/hbnetio/netiomgm.hb
  * contrib/hbwin/tests/ole.prg
  * contrib/hbwin/tests/oletst2.js
  * contrib/hbwin/tests/oletst2.vbs
  * contrib/hbxpp/doc/en/binnumx.txt
  * contrib/hbxpp/doc/en/dbcmdx.txt
  * contrib/xhb/htmutil.prg
  * contrib/xhb/tfile.prg
  * contrib/xhb/tframe.prg
  * contrib/xhb/thtm.prg
  * ChangeLog.txt
  * debian/copyright
  * doc/class_tp.txt
  * doc/hdr_tpl.txt
  * doc/xhb-diff.txt
  * LICENSE.txt
  * package/harbour-wce.spec.in
  * package/harbour-win.spec.in
  * package/harbour.spec
  * package/mpkg_rpm_wce.sh
  * package/mpkg_rpm_win.sh
  * package/mpkg_rpm.sh
  * package/mpkg_src.sh
  * package/mpkg_ver.sh
  * src/rtl/achoice.prg
  * src/rtl/getsys53.prg
  * src/rtl/tgetlist.prg
  * src/rtl/tlabel.prg
  * src/rtl/tmenusys.prg
  * tests/hbdoc.prg
  * tests/langmsg.prg
  * tests/rto_get.prg
  * tests/rto_tb.prg
  + doc/en/ati.txt
  + doc/en/dirdrive.txt
  + doc/en/hashfunc.txt
  + doc/en/hbtoken.txt
  + doc/en/left.txt
  + doc/en/proc.txt
  + doc/en/strtran.txt
  + doc/en/transfrm.txt
  + doc/en/typefile.txt
  * doc/en/*
    * more partial sync with 3.4 fork
2017-09-08 18:25:11 +00:00

99 lines
3.4 KiB
Plaintext

/* $DOC$
$AUTHOR$
Copyright 2000 Luiz Rafael Culik <culik@sl.conex.net>
$TEMPLATE$
Function
$NAME$
Transform()
$CATEGORY$
API
$SUBCATEGORY$
Strings
$ONELINER$
Formats a value based on a specific picture template.
$SYNTAX$
Transform( <xExpression>, <cTemplate> ) --> cFormatted
$ARGUMENTS$
<xExpression> Any expression to be formatted.
<cTemplate> Character string with picture template
$RETURNS$
<cFormatted> Formatted expression in character format
$DESCRIPTION$
This function returns <xExpression> in the format of the picture
expression passed to the function as <cTemplate>.
Their are two components that can make up <cTemplate> : a function
string and a template string. Function strings are those functions
that globally tell what the format of <xExpression> should be. These
functions are represented by a single character precede by the
@ symbol.
There are a couple of rules to follow when using function strings
and template strings:
- First, a single space must fall between the function template
and the template string if they are used in conjunction with
one another.
- Second, if both components make up the value of <cTemplate>, the
function string must precede the template string. Otherwise, the
function string may appear with out the template string and
vice versa.
The table below shows the possible function strings available with
the Transform() function.
<table-noheader>
@B Left justify the string within the format.
@C Issue a CR after format is numbers are positive.
@D Put dates in SET DATE format.
@E Put dates in BRITISH format.
@L Make a zero padded string out of the number.
@R Insert non template characters.
@X Issue a DB after format is numbers are negative.
@Z Display any zero as blank spaces.
@( Quotes around negative numbers
@! Convert alpha characters to uppercased format.
</table>
The second part of <cTemplate> consists of the format string. Each
character in the string may be formatted based on using the follow
characters as template markers for the string.
<table-noheader>
A,N,X,9,# Any data type
L Shows logical as "T" or "F"
Y Shows logical as "Y" or "N"
! Convert to uppercase
$ Dollar sing in place of leading spaces in numeric expression
* Asterisks in place of leading spaces in numeric expression
, Commas position
. Decimal point position
</table>
$EXAMPLES$
LOCAL cString := "This is harbour"
LOCAL nNumber := 9923.34
LOCAL nNumber1 := -95842.00
LOCAL lValue := .T.
LOCAL dDate := Date()
? "working with String"
? "Current String is", cString
? "All uppercased", Transform( cString, "@!" )
? "Date is", dDate
? "Date is", Transform( dDate, "@D" )
? Transform( nNumber, "@L 99999999" ) // --> "009923.34"
? Transform( 0 , "@L 9999" ) // --> "0000"
$STATUS$
R
$COMPLIANCE$
The @L function template is a FoxPro/Xbase++ Extension
$PLATFORMS$
All
$FILES$
Library is core
$SEEALSO$
@...SAY, DevOutPict()
$END$
*/