xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Expand()

Inserts characters between all characters in a string.

Syntax

Expand( <cString>, ;
       [<nCount>], ;
       [<xChar>]   ) --> cResult

Arguments

<cString>
This is the character string to process.
<nCount>
Optionally, the number of characters to insert between each character can be specified. The default value is 1.
<xChar>
This is a single character or its numeric ASCII code that is inserted <nCount> times between each character of <cString>. It defaults to a blank space (Chr(32)).

Return

The function iterates <cString>, inserts the character sequence Replicate( <xChar>, <nCount> ) between characters of <cString>, and returns the expanded result.

Info

See also:CharSpread(), PadLeft(), PadRight()
Category: CT:String manipulation , Character functions
Source:ct\spread.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example displays results of Expand()

   PROCEDURE Main
      LOCAL cStr1 := "xHarbour"
      LOCAL cStr2 := "ABCD"

      ? Expand( cStr1 )          // result: x H a r b o u r
      ? Expand( cStr2, 3, "." )  // result: A...B...C...D
   RETURN

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