StrTran()

StrTran()

Translate substring value with a main string

Syntax

      StrTran( <cString>,  <cLocString>,  [<cRepString>],  
               [<nPos>], [<nOccurrences>] ) --> cReturn

Arguments

<cString> The main string to search

<cLocString> The string to locate in the main string

<cRepString> The string to replace the <cLocString>

<nPos> The first occurrence to be replaced

<nOccurrences> Number of occurrence to replace

Returns

<cReturn> Formated string

Description

This function searches for any occurrence of <cLocString> in <cString> and replaces it with <cRepString>. If <cRepString> is not specified, a NULL byte will replace <cLocString>.

If <nPos> is used, its value defines the first occurrence to be replaced. The default value is 1. Additionally, if used, the value of <nOccurrences> tell the function how many occurrences of <cLocString> in <cString> are to the replaced. The default of <nOccurrences> is all occurrences.

Examples

      ? StrTran( "Harbour  Power",  "  ",  " " )   // Harbour Power
      // Harbour Power The future  of  xBase
      ? StrTran( "Harbour  Power  The Future  of  xBase",  "  ",  " " ,  ,  2 )

Compliance

Clipper

Platforms

All(64K)

Files

Libraty is rtl

Seealso

SubStr(), At()

3 responses to “StrTran()

  1. Pingback: Harbour All Functions – S | 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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.