| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Searches the first position where two character strings are equal.
PosEqual( <cString1> , ;
<cString2> , ;
[<nCompare>] , ;
[<nSkipChars>] ) --> nPos
The function returns the ordinal position of the first character that is the same in both input strings, or 0 if both strings are completely different.
| See also: | PosEqual() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\posdiff.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of PosEqual()
PROCEDURE Main
LOCAL cStr1 := "xHarbour compiler"
LOCAL cStr2 := " Clipper compiler"
// check if strings are equal
? PosEqual( cStr1, cStr2 ) // result: 0
// find a minimum of 4 equal characters
? Posequal( cStr1, cStr2, 4 ) // result: 8
RETURN
http://www.xHarbour.com