Difference between revisions of "RTRIM$"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''RTRIM$''' removes spaces from the end(right) of a string value.
+
The {{KW|RTRIM$}} function removes trailing space characters from a {{KW|STRING}} value.
  
''Example:'' name$ = RTRIM$("Tommy   ")
+
 
''Returns:'' name$ = "Tommy"
+
{{PageSyntax}}
 +
:{{parameter|return$}} = {{KW|RTRIM$}}({{Parameter|value$}})
 +
 
 +
 
 +
{{PageDescription}}
 +
* {{Parameter|value$}} is the {{KW|STRING}} value to trim.
 +
* If {{Parameter|value$}} contains no trailing space characters, {{Parameter|value$}} is returned unchanged.
 +
* Convert fixed length {{KW|STRING}} values by using a different {{parameter|return$}} variable.
 +
 
 +
 
 +
 
 +
{{PageExamples}}
 +
Trimming a fixed length string value for use by another string variable:
 +
{{CodeStart}}
 +
name$ = {{Cl|RTRIM$}}(contact.name) ' trims spaces from end of fixed length {{Cl|TYPE}} value.
 +
{{CodeEnd}}
 +
 
 +
Trimming text string ends:
 +
{{CodeStart}}{{Cl|PRINT}} {{Cl|RTRIM$}}("some text") + "."
 +
{{Cl|PRINT}} {{Cl|RTRIM$}}("some text   ") + "."
 +
{{Cl|PRINT}} {{Cl|RTRIM$}}("Tommy   ")
 +
{{CodeEnd}}
 +
{{OutputStart}}some text.
 +
some text.
 +
Tommy
 +
{{OutputEnd}}
 +
 
 +
 
 +
{{PageSeeAlso}}
 +
* {{KW|LTRIM$}}, {{KW|STR$}}
 +
 
 +
* {{KW|LSET}}, {{KW|RSET}}
 +
 
 +
 
 +
{{PageNavigation}}

Latest revision as of 15:02, 14 November 2010

The RTRIM$ function removes trailing space characters from a STRING value.


Syntax

return$ = RTRIM$(value$)


Description

  • value$ is the STRING value to trim.
  • If value$ contains no trailing space characters, value$ is returned unchanged.
  • Convert fixed length STRING values by using a different return$ variable.


Examples

Trimming a fixed length string value for use by another string variable:

name$ = RTRIM$(contact.name) ' trims spaces from end of fixed length TYPE value.

Trimming text string ends:

PRINT RTRIM$("some text") + "." PRINT RTRIM$("some text ") + "." PRINT RTRIM$("Tommy ")

some text. some text. Tommy


See also



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