xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

AtAdjust()

Justifies a character sequence within a string.

Syntax

AtAdjust( <cSearch>    , ;
          <cString>    , ;
          <nEndPos>    , ;
         [<nCount>]    , ;
         [<nSkipChars>], ;
         [<xInsChar>]    ) --> cJustified

Arguments

<cSearch>
This is a character string to search for in <cString>.
<cString>
This is the character string to find <cSearch> in.
<nEndPos>
This is a numeric value specifying the last character of <cString> to include in the search.
<nCount>
A numeric value indicating the number of occurrences of finding <cSearch> in <cString> before the function returns. It defaults to the last occurrence.
<nSkipChars>
This numeric parameter defaults to 0 so that the function begins searching with the first character of <cString>. Passing a value > 0 instructs the function to ignore the first <nSkipChars> characters in the search.
<xInsChar>
This parameter defaults to 32, i.e. Chr(32) is inserted into <cString> for justifying <cSearch>. <xInsChar> is either a numeric ASCII code or a single character of Valtype()="C".

Return

The function returns the justified string.

Description

AtAdjust() begins searching <cSearch> in <cString> at the first plus <nSkipChars> characters. It terminates searching after <nCount> occurrences or after the last occurrence of <cSearch>. It inserts <xInsChar> up to <nEnpos> and returns returns modified string. The function recognizes the CSetAtMuPa() and SetAlike() settings.

Info

See also:AtNum(), CSetAtMuPa(), SetAtLike()
Category: CT:String manipulation , Character functions
Source:ct\atadjust.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example justifies a serias of character strings by
// inserting dots into the result string.

   PROCEDURE Main
      LOCAL aNames := { "Hagen, Walter"  , ;
                         "McKenzie, Scott", ;
                         "Ho, Li-Minh"      }
      LOCAL cName

      FOR EACH cName IN aNames
         cName := AtAdjust( ",", cName, 12, 1, 0, "." )
         ? CharRem( ", ",  cName )
      NEXT

      ** result
      // Hagen......Walter
      // McKenzie...Scott
      // Ho.........Li-Minh
   RETURN

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