Navigation:  thinBasic Modules > Core > String handling >

Rotate$

Previous pageReturn to chapter overviewNext page

 

Description

 

Switch left or right a string buffer.

 

Syntax

 

s = ROTATE$(StringExpression, nChars)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

StringExpression

String

No

Original string to rotate

nChars

Numeric

No

Number of chars to rotate right (if positive) or left (if negative)

 

Remarks

 

Restrictions

 

See also

 

String Handling, LEFT$, MID$,

 

Examples

 

Thanks to Psch for the following script example

' Usage of the Rotate$ Keyword example

 

Dim s As String

 

s = ROTATE$("ANANAS", 1)

MSGBOX 0, s  ' -- This would show 'SANANA'

 

s = ROTATE$("ANANAS", -1)

MSGBOX 0, s  ' -- This would show 'NANASA'