Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

TRANSFORM()

Formats a value based on a specific picture template.
---------------------------------------------------------------------------------

 Syntax

        TRANSFORM( <xExpression>, <cTemplate> )  --> cFormated  

 Arguments

        <xExpression>   Any expression to be formated.      

        <cTemplate>     Character string with picture template    

 Returns

        <cFormated>     An 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 avaliable with
      the TRANSFORM() function.

      +-------------------------------------------------------+
      | @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 nontemplate 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.   |
      +-------------------------------------------------------+

      The second part of <cTemplate> consists of the format string.Each
      character in the string may be formated based on using the follow
      characters as template markers for the string.

+-------------------------------------------------------------------------+
| A,N,X,9,# | Any data type                                               |
| L         | Shows logical as "T" or "F"                                 |
| Y         | Shows logical as "" or "N"                                  |
| !         | Convert to uppercase                                        |
| $         | Dolar sing in place of leading spaces in numeric expression |
| *         | Asterisks in place of leading spaces in numeric expression  |
| ,         | Commas position                                             |
| .         | Decimal point position                                      |
+-------------------------------------------------------------------------+

 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"


 Tests

      See regression Test

Status

      Ready

 Compliance

      The  @L function template is a FOXPRO/Xbase Extension

 Platforms

      All

 Files

      Library is rtl



See Also: DEVOUTPICT()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson