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()
Pingback: Harbour All Functions – S | Viva Clipper !
Pingback: Harbour String Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !