xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

ReplAll()

Replaces a specified character on both sides of a string.

Syntax

ReplAll( <cString> , ;
         <xReplace>, ;
        [<xSearch>]  ) --> cResult

Arguments

<cString>
This is the character string to replace characters on both sides.
<xReplace>
This is a single character or its numeric ASCII code that replaces <xSearch> on both sides of <cString>.
<xSearch>
A single character or its numeric ASCII code can be passed. This character is replaced by <xReplace>. The default value is a space character (Chr(32)).

Return

The function replaces characters specified with <xSearch> at the beginning and end of <cString> with <xReplace> and returns the modified string.

Info

See also:ReplLeft(), ReplRight(), StrTran()
Category: CT:String manipulation , Character functions
Source:ct\replace.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays results of ReplAll()

   PROCEDURE Main
      LOCAL cStr1 := "  xHarbour  "
      LOCAL cStr2 := "00012345,000"

      ? ">"+ReplAll( cStr1, "_" )+"<"        // result: >__xHarbour__<

      ? ">"+ReplAll( cStr2, "x", "0" )+"<"   // result: >xxx12345,xxx<
   RETURN

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