$string

Returns a string containing the character represented by each named XML entity in the input parameter. (XML entities are character mappings, not Uniface entities.)

$string(String)

Example: $string("XML entities include: <, >, &")

Parameters

Parameters
Parameter Data Type Description
String

String

String that contains zero or more XML entities. The allowed XML entities are:

  • Unicode in decimal or hexadecimal format
  • Selected standard XML character entities
  • Selected Uniface-defined XML character entities

Return Values

String with the allowed XML character entities replaced by the characters they represent.

Use

Allowed in all component types.

Description

The allowed XML entities in $string are described in the following tables.

Unicode in decimal or hexadecimal format
Format Syntax Description Example
Decimal &#nnnn; n is a number: 0–9. $string("A") returns the string: "A".

Hexadecimal

&#xnnnn; n is an alphanumeric character: 0–9 and A–F or a–f. $string("A") returns the string: "A".
Standard XML entities allowed in $string
XML entity Character Description
&lt; < Less than sign
&gt; > Greater than sign
&amp; & Ampersand
&apos; ' Apostrophe
&quot; " Quotation mark
Uniface-defined XML entities allowed in $string
Uniface XML entity Character Description
&uNL; CR New line
&uPG; FF New page
&uTAB; HT Tab
&uALL; GOLD * Profile character (match 0-n characters)
&uONE; GOLD ? Profile character (match any single character)
&uEQ; GOLD = Profile character (is equal to)
&uNOT; GOLD ! Profile character (logical NOT)
&uOR; GOLD | Profile character (logical OR)
&uAND; GOLD & Profile character (logical AND)
&uGT; GOLD > Profile character (is greater than)
&uLT; GOLD < Profile character (is less than)
&uSEP; GOLD ; Subfield separator

Description

Note:  The $string ProcScript function should not be confused with the $string converter used in $typed. For more information, see $typed.

Using $string

In the following example, FLD is a String field whose packing code is W*.

vString1=$string("XML has five predeclared entities.") ;0 xml entity
vString2=$string("They are: &lt;, &gt;, &amp;, %\
&apos;, and &quot;.")                            ;5 xml entities

FLD="%%vString1%%^%%vString2"

After executing this ProcScript, field FLD contains the following:

XML has five predeclared entities.
They are: <, >, &, ', and ".

You can generate all characters in the Unicode character set using the $string function. The following ProcScript generates the 26 uppercase Latin 1 alphabet. FLD is a String field whose packing code is W*.

$1=65
vString=""
while($1 < 91)
   vString="%%vString%%%&#%%$1;"
   $1=$1+1
endwhile
FLD=$string(vString)

After executing this ProcScript, field FLD contains:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
History
Version Change
9.1.01 Introduced

Related Topics