POSEQUAL()

POSEQUAL()

The left-most position there two string begin to be equal

Syntax

       POSEQUAL( <cString1>, <cString2>, [<nCompare>], [<nIgnore>] )
                  -> nPosition

Arguments

<cString1> and <cString2> Designate the two character strings that are compared.

<nCompare> Designates the number of characters that must be the same. The default value is the length of the shorter string.

<nIgnore> Designates the number of characters that are disregarded at the beginning of the search. The default value is none.

Returns

POSEQUAL() returns the position from which the two character strings are the same for <nCompare> characters. If no corresponding agreement is found, the function returns 0.

Description

POSEQUAL() allows you to determine at which point two strings agree. The length of this agreement is represented by <nCompare>. If not specified, <nCompare> defaults to the length of the shorter string.

Additionally, the <nIgnore> parameter lets you specify a particular number of characters that are excluded from the start of the strings during the comparison.

Examples

       .  In this example, there is no agreement to the end of the
              string:
              cString1   :=  "ABCDEFGHI"
              cString2   :=  "XYZDEKLMN"
              ? POSEQUAL(cString1, cString2)                  // Result: 0
           .  This example shows the agreement of at least two characters:
              ? POSEQUAL(cString1, cString2, 2)               // Result: 4
           .  This example shows a single character agreement and excludes
              the first four characters:
              ? POSEQUAL(cString1, cString2, 1, 4)            // Result: 5

Compliance

POSEQUAL() is compatible with CT3’s POSEQUAL().

Platforms

All

Files

Source is posdiff.c, library is libct.

Seealso

POSDIFF()

Advertisements

2 responses to “POSEQUAL()

  1. Pingback: Harbour String Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – P | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s