Skip to content

Modern String Reverse

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › String Library › String Library › Reverse

Reverse

Returns the string with its characters in reverse order.

Syntax

Reverse( s )

Notes

  • O(n)

Examples

#import "std/strings"
using strings

print Reverse( "abcdef" )     '' fedcba
print Reverse( "" )           '' (empty)

'' A ustring reverses by character, keeping surrogate pairs intact;
'' a STRING is bytes with no declared encoding, so it reverses bytes
dim as ustring u = "abc"
print Reverse( u )            '' cba

Library: String Library
Category: String Library
Documented under: The Functions

Clone this wiki locally