Passa al contenuto principale

StringConv, string conversion

Questa funzione esegue conversioni su stringhe, può essere definita la stessa stringa sia come sorgente che come destinazione.

Descrizione​

Immagine funzione StringConv

ParametroTipoDescrizione
Destination@STRINGIndirizzo buffer destinazione stringa convertita.
Source@STRINGIndirizzo stringa da convertire.
DSizeUDINTDimensione buffer destinazione stringa convertita.
ModeSTR_CONVDefinizione modo conversione (Definizione).
OutBOOLLa funzione ritorna una variabile BOOL, FALSE se errore conversione, TRUE se conversione Ok.

Esempi​

Come utilizzare gli esempi.
Sono eseguite alcune conversioni di stringa.

LogicLab (Ptp201, ST_StringConv)
PROGRAM ST_StringConv
VAR
SString : STRING[ 26 ]:= 'abCdefGHIjklmnoPqrtSUVwxyz'; (* Source string *)
CString : STRING[ 26 ]; (* Copy string *)
DString : STRING[ 12 ]; (* Destination string *)
LString : STRING[ 26 ]; (* Lower character string *)
UString : STRING[ 26 ]; (* Upper character string *)
RSts : ARRAY[0..4] OF BOOL; (* Result status *)
END_VAR

// *****************************************************************************
// PROGRAM "ST_StringConv"
// *****************************************************************************
// This program shows the use of "StringConv" function.
// -----------------------------------------------------------------------------

// -------------------------------------------------------------------------
// STRING CONVERSION
// -------------------------------------------------------------------------
// Some string conversion examples.

RSts[0]:=StringConv(ADR(CString), ADR(SString), SIZEOF(CString), STR_CONV#SCV_COPY);
RSts[1]:=StringConv(ADR(DString), ADR(SString), SIZEOF(DString), STR_CONV#SCV_COPY);
RSts[2]:=StringConv(ADR(DString), ADR(DString), SIZEOF(DString), STR_CONV#SCV_TOLOWER);
RSts[3]:=StringConv(ADR(LString), ADR(SString), SIZEOF(LString), STR_CONV#SCV_TOLOWER);
RSts[4]:=StringConv(ADR(UString), ADR(SString), SIZEOF(UString), STR_CONV#SCV_TOUPPER);

// [End of file]