xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

PosDiff()

Searches the first position where two character strings differ.

Syntax

PosDiff( <cString1>, <cString2>, [<nSkipChars>]) --> nPos

Arguments

<cString1> and <cString2>
These are two character strings whose characters are compared.
<nSkipChars>
This numeric parameter defaults to 0 so that the function begins searching with the first character of <cString1>. Passing a value > 0 instructs the function to ignore the first <nSkipChars> characters in the search.

Return

The function returns the ordinal position of the first character that differs in both input strings, or 0 if both strings are identical.

Info

See also:PosEqual()
Category: CT:String manipulation , Character functions
Source:ct\posdiff.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe