Skip to main content
Version: v6.0.0

String-Compare-with-Len

Command Description​

According to specified length, compare two strings starting from left, and return True when they are equal, otherwise return False

Command Prototype​

bRet = StrNComp(s1,s2,iLen,bCompare)

Parameter Description​

ParameterRequiredTypeDefaultDescription
s1Truestring""The first string to be compared
s2Truestring""The second string to be compared
iLenTruenumber1The string length to be compared
bCompareTruebooleanNoneWhether to be case sensitive when strings are compared

return​

bRet,The variable used to save the output of the command.

Demo​

TracePrint("----------------------string specified length comparison-------------------- ----") 
//-------------------------------------------------------------------------------
//[Remarks] According to the specified number of digits, compare 2 strings from the left, if the strings are the same, return true, otherwise return false.
//Input parameter 1:
// s1--The first string to compare.
//Input parameter 2:
// s2--The second string to compare.
//Input parameter 3:
// iLen--The length of the string to compare.
//Input parameter 4:
// bCompare--Whether it is case sensitive when comparing strings.
//out parameters:
// bRet--The variable to which the output of the function call is saved.
//
//Command prototype: bRet=StrNComp(s1,s2,iLen,bCompare)
//-------------------------------------------------------------------------------
bRet=StrNComp("Ui","UiBot",2,true)
TracePrint(bRet)