Click or drag to resize

Unformat Function

X#
Convert a transformed string back to its original value.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION Unformat(
	cFormatString AS STRING,
	cSayPicture AS STRING,
	cType AS STRING
) AS USUAL
Request Example View Source

Parameters

cFormatString
Type: String
The string to convert.
cSayPicture
Type: String
The picture string used when the original value was converted.
cType
Type: String
The data type of the original value.
This can be any valid X# data type except array, code block, object, and NIL.

Return Value

Type: Usual
The original value.
Remarks
Unformat() is the inverse of Transform().
It uses the picture string to convert back to its original value a value that was converted into a formatted string with the Transform() function.
It is useful for converting data that was entered from a single-line edit which included picture characters.
Tip Tip
If the Transform() function overwrote characters in the original value, the overwritten characters are lost and the characters that overwrote them appear in their place.
Also, any characters or numbers that were truncated are not restored.
Examples
This example converts a number in currency format back to its original numeric format:
X#
1? Unformat("$123,456.78", "@R $999,999.99", "N")
2                        // Result: numeric 123456.78
This example converts a formatted string back to its unformatted state:
X#
1? Unformat("(516)555-1212", "@R (AAA)AAA-AAAA", "C")
2                        // Result: string 5165551212
See Also