nameCheck()
Checks if the name of a data point or name of a project only contains the permitted characters.
Replaces the dpNameCheck() and dpIsLegalName() functions which remain for compatibility reasons!
Synopsis
int nameCheck( string &dpName [, int nameType]);
Parameters
Parameter | Description |
---|---|
dpName | DP or project name. |
nameType |
Constants that specify the check type:
|
Return value
The function returns 0 if the name only contains permitted characters and otherwise -1. When the function returns -1, it also returns the corrected name (therefore, the syntax contains the "&" character).
Error
Description
Checks if the name of a data point or project name only contains the permitted characters. The function also checks multibyte characters. The returned result is 0 (only permitted characters) or -1 (illegal characters). The corrected name is returned in the dpName parameter.
Example
The example checks if the name of the data point in the text field is correct. It also writes the corrected data point name into the text field after a delay.
main()
{
string dpName1 ="/Data point1%";
DebugN("Data point name:", dpName1);
TEXT_FIELD1.text = dpName1;
int i = nameCheck(dpName1, 1);
if(i == 0)
DebugN("The data point name does not contain any illegal characters:", dpName1);
else
{
DebugN("Data point name contains illegal characters");
DebugN("Corrected name: ", dpName1);
delay(3,30);
TEXT_FIELD1.text = dpName1;
}
}
Assignment
Data point function
Availability
CTRL