Difference between revisions of "RIGHT$"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m (format)
imported>Clippy
m
Line 3: Line 3:




''Syntax:'' RIGHT$(stringvalue$, numberofcharacters%)
{{PageSyntax}}
 
:: RIGHT$(stringvalue$, numberofcharacters%)




Line 11: Line 11:
* Number of characters cannot be a negative value.
* Number of characters cannot be a negative value.
* RIGHT$ returns always start at the last character of the string, even if a space. [[RTRIM$]] can remove ending spaces.
* RIGHT$ returns always start at the last character of the string, even if a space. [[RTRIM$]] can remove ending spaces.




''Example:'' Getting the right portion of a string value.  
''Example:'' Getting the right portion of a string value.  
{{CodeStart}}
{{CodeStart}}
name$ = "Tom Williams"
name$ = "Tom Williams"


Last$ = RIGHT$(name$, 8)
Last$ = RIGHT$(name$, 8)


PRINT Last$
PRINT Last$ '' ''
 
{{CodeEnd}}
{{CodeEnd}}
{{OutputStart}}
{{OutputStart}}
Line 31: Line 28:


''See also:''  
''See also:''  
* [[LEFT$]], [[MID$]]  
* [[LEFT$]], [[MID$]]  
* [[LTRIM$]], [[RTRIM$]]  
* [[LTRIM$]], [[RTRIM$]]  




{{PageNavigation}}
{{PageNavigation}}

Revision as of 00:42, 10 May 2011

The RIGHT$ function returns a set number of characters in a STRING variable starting from the end and counting backwards.


Syntax

RIGHT$(stringvalue$, numberofcharacters%)


  • The string value can be any string of ASCII characters as a string variable.
  • If the number of characters exceeds the string length(LEN) the entire string is returned.
  • Number of characters cannot be a negative value.
  • RIGHT$ returns always start at the last character of the string, even if a space. RTRIM$ can remove ending spaces.


Example: Getting the right portion of a string value.

name$ = "Tom Williams" Last$ = RIGHT$(name$, 8) PRINT Last$

Williams


See also:



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page