hb_At()

hb_At()

Locates the position of a substring in a main string.

Syntax

      hb_At( <cSearch>,  <cString>,  [<nStart>],  [<nEnd>] ) --> nPos

Arguments

<cSearch> Substring to search for

<cString> Main string

<nStart> First position to search in cString, by default 1

<nEnd> End position to search, by default cString length

Returns

hb_At() return the starting position of the first occurrence of the substring in the main string

Description

This function searches the string <cString> for the characters in the first string <cSearch>. If the substring is not contained within the second expression, the function will return 0. The third and fourth parameters lets you indicate a starting and end offset to search in.

Examples

      ? 'hb_At( "cde",  "abcdefgfedcba" ) = ' + ;
         Str( hb_At( "cde",  "abcdefgfedcba" ) )       // 3
      ? 'hb_At( "cde",  "abcdefgfedcba" ) = ' + ;
         Str( hb_At( "cde",  "abcdefgfedcba",  4 ) )    // 0

Compliance

This function is sensitive to HB_CLP_STRICT settings during build.

<nStart> and <nEnd> are Harbour extensions and do not exist if HB_CLP_STRICT is defined. In that case, the whole string is searched.

Platforms

All

Files

Library is core

Seealso

hb_RAt()

Advertisements

3 responses to “hb_At()

  1. Pingback: Harbour All Functions – H | Viva Clipper !

  2. Pingback: Harbour String Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | 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