Commands and functions
P.
226 of 349
Capacity
Tostring
Encode
Definition
●
Function
capacity
(
String
)
Arguments
●
An argument,
string
of data type c1400 respectively with a self defined string length
Effect
●
From the string band
String
the maximum available length is to be determined
Data type result (Return)
●
Data type u16
Example: capacity
The maximum available length of the string=$string band$ is to be determined.
Implementation in the user program:
string=$string band$
result=capacity(string)
Definition
●
Function
tostring
(
char1[,char2, ... charN]
)
Arguments
●
At least one argument, char1 of the data type u08 as the character code of the UTF-8
encoding (see http://de.wikipedia.org/wiki/UTF-8)
Effect
●
A string from the individual bytes is formed, the terminating zero is automatically appended
Data type result (Return)
●
Data type c1400
Example: capacity
The maximum available length of the string=$string band$ is to be determined.
Implementation in the user program
Eurosign=tostring(0xE2,0x82,0xAC)
Definition
●
Function
encode
(
string, source encoding, target encoding
)
Arguments
●
An argument,
string
of data type c1400 respectively with a self defined string length
●
Source encoding
with the usual designation, e.g. „UTF-8“
●
Target encoding
with the usual designation, e.g. „UTF-8“
Effect
●
A string band
string
, which is present in the source encoding, is going to be transferred in
the target encoding.
Data type result (return)
●
Data type string format
Example: encode
Recode a string from UTF-8 to ISO-8859
Implementation in the user program:
// String
s1=$Hallöchen$c4000
// String code from UTF to Windows (German);
sDE=encode(s1,$UTF-8$c14,$ISO-8859-15$c14)
Recode a string from EISO-8859 to UTF-8
// String code from UTF to Windows (Europe):
sEU=encode(s1,$UTF-8$c14,$ISO-8859-1$c14)
sUTF=encode(sDE,$ISO-8859-1$c14,$UTF-8$c14)
Please also read the notes on p. 108
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]