HyperMath

StrnCmp

StrnCmp

Previous topic Next topic No expanding text in this topic  

StrnCmp

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Compares the first n characters of two strings.

Syntax

bRes = StrnCmp(str1, str2, n)

Arguments

Name

Description

 

str1

A string.

 

str2

A string.

 

n

A number: the number of characters to compare.

Outputs

Name

Description

 

bRes

A number (0 or 1).

Example

Syntax

 

print(StrnCmp('HyperMath','Hypermath',6))

print(StrnCmp('HyperMath','Hypermath',5))

Comments

bRes = StrnCmp(str1, str2, n) returns 1 if the first n characters of strings str1 and str2 are the same (and 0 in the other cases).

Comparaison is case sensitive.

See Also:

StrCmp