xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

CharRela()

Tests if two substrings in two strings have the same position.

Syntax

CharRela( <cSearch1>, ;
          <cString1>, ;
          <cSearch2>, ;
          <cString2>  ) --> nPosition

Arguments

<cSearch1>
This is a character string to search in <cString1>.
<cString1>
This is the character string to find <cSearch1> in.
<cSearch2>
This is a character string to search in <cString2>.
<cString2>
This is the character string to find <cSearch2> in.

Return

The function searches <cSearch1> in <cString1>, and <cSearch2> in <cString2>. If both search strings are found at the same position in both strings, the function returns it as a numeric value. The return value is zero when no match is found.

Info

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

Example

// The example compares the position of letters in a string
// with the position of digits in a second string.

   PROCEDURE Main
      LOCAL cString1 := "abbaacc"
      LOCAL cString2 := "0011011"

      ? CharRela( "a", cString1, "1", cString2 ) // result: 4
      ? CharRela( "b", cString1, "1", cString2 ) // result: 3
      ? CharRela( "c", cString1, "1", cString2 ) // result: 6
      ? CharRela( "c", cString1, "0", cString2 ) // result: 0
   RETURN

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