Nozioni fondamentali > Relazioni e parametri > Relazioni > Operatori e funzioni utilizzati nelle relazioni > Operatori e funzioni per stringhe
  
Operatori e funzioni per stringhe
Per le stringhe vengono supportati i seguenti operatori e funzioni:
==
Paragona le stringhe come uguali.
!=, <>, ~=
Paragona le stringhe come diverse.
+
Concatena le stringhe.
itos(int)
Converte i numeri interi in stringhe. Qui, int può essere un numero oppure un'espressione. Le cifre non intere vengono arrotondate.
search(string, substring)
Ricerca per sottostringhe. Il valore risultante rappresenta la posizione della sottostringa nella stringa (0 se non viene trovata).
extract(string, position, length)
Estrae parti di stringhe.
string_starts (stringa 1, stringa 2)
TRUE, se il valore della stringa 1 inizia con il valore della stringa 2.
string_ends (stringa 1, stringa 2)
TRUE, se il valore della stringa 1 termina con il valore della stringa 2.
string_match (stringa 1, stringa 2)
TRUE, se il valore della stringa 1 corrisponde al valore della stringa 2.
Ad esempio:
Se param = abcdef, allora:
flag = param == abcdef - restituisce TRUE
flag = abcdef != ghi - restituisce TRUE
new = param + ghi - new è abcdefghi
new = itos(10 + 7) - new è 17
new = param + itos(1.5) - new è abcdef2
where = search(param, bcd) - where è 2
where = search(param, bcd) - where è 0
new = extract(param,2,3) - new è bcd
 
* Se la funzione itos viene utilizzata in un parametro con valore zero (0), il valore restituito è una stringa vuota.
Nell'esempio seguente viene illustrata la funzione itos.
integer_param = 4
string_param = itos(integer_param)
/*string_param restituirà 4 */
integer_param = -7
string_param = itos(int_param)
/*string_param restituirà -7 */
Per un numero intero con valore zero (0), la funzione itos restituisce un valore nullo ("") come mostrato di seguito:
integer_param = 0
string_param = itos(int_param)
/*string_param restituirà una stringa vuota o nulla ("") */
Per ottenere la restituzione di un valore di stringa pari a zero ("0"), utilizzate l'istruzione IF seguente:
integer_param = 0
string_param = itos(integer_param)
IF string_param == ""
string_param = "0"
ENDIF