Download VTB – Visual Tool Basic IDE User Manual

Transcript
11.5 API FUNCTIONS FOR MANAGING OF STRINGS
VTB doesn't use STRING variables, to manage them there are some apposite functions similar to the “C”
language.
11.5.1 GET_TABSTR
Gets a string from a text table and put it in the system variable _SYSTEM_STRING.
Hardware
All
Syntax
GET_TABSTR (Char Table, Char Msg, Char Lng)
Parameters
Table
Msg
Lng
Index of the table
Index of the string inside the table
Index of the language to be used
Example
Get_tabstr(0,1,_SYSTEM_LINGUA)
Draw_str(_system_string())
‘
‘ Read the second message (idx 1) from the
‘ first (odx 0) table using the current
‘ language
Print _system_string
11.5.2 STRCPY
Copies the string pointed by SOURCE into the array pointed by DEST. The string must terminate with the
character 0 (NULL).
Hardware
All
Syntax
STRCPY (Char *Dest, Char *Source)
Parameters
Dest
Source
Pointer to destination
Pointer to source
Example
Used variables:
Dest(10) char
Dest1(10) char
strcpy(Dest(),”prova testo”) ‘ copy the string “prova testo” in dest
strcpy(Dest1(),Dest())
‘copy the string “prova testo” in dest1
11.5.3 STRLEN
Returns the length of a string.
Hardware
All
Syntax
STRLEN(Char *Str) as int
Parameters
Str
Pointer to the string
Return value:
Length of the string.
Example
Used variables:
Len int
Len=StrLen(”prova testo”)
‘ ritorna il value 11