| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Searches the first position where two character strings differ.
PosDiff( <cString1>, <cString2>, [<nSkipChars>]) --> nPos
The function returns the ordinal position of the first character that differs in both input strings, or 0 if both strings are identical.
| See also: | PosEqual() |
| Category: | CT:String manipulation , Character functions |
| Source: | ct\posdiff.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of PosDiff()
PROCEDURE Main
LOCAL cStr1 := "xHarbour compiler"
LOCAL cStr2 := "xHarbour company"
? PosDiff( cStr1, cStr2 ) // result: 14
? PosDiff( cStr1, Upper(cStr2) ) // result: 1
RETURN
http://www.xHarbour.com