xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Right()

Extracts characters from the right side of a string

Syntax

Right( <cString>, <nCount> ) --> cSubString

Arguments

<cString>
A character string to extract a substring from.
<nCount>
A numeric value specifying the number of characters to extract from the right side of <cString>.

Return

The function returns a character string containing Min( <nCount>, Len(<cString>) ) characters.

Description

The character function Right() extracts a substring from the right side of <cString>. The returned substring contains <nCount> characters. If <nCount> is larger than Len(<cString>), the return value is a copy of <cString>.

The counterpart of Right() is Left(), which extracts a substring from the left side of a string.

Info

See also:At(), HB_ATokens(), Left(), LTrim(), RAt(), RTrim(), Stuff(), SubStr()
Category: Character functions
Source:rtl\right.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example illustrates return values of function Right()

   PROCEDURE Main
      ? CDoW(Date())                   // result: Friday
      ? Right( CDoW(Date()), 3)        // result: day

      ? Time()                         // result: 14:45:12
      ? Right( Time(), 5)              // result: 45:12

      ? Right("xHarbour", 7)            // result: Harbour
   RETURN

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