Home Contents | # string.revert | String | Core4 Lua Commands

## SYNOPSIS

result = string.revert(s [, i [, j]])

## DESCRIPTION

Reverses the order of bytes in the string.

When i and/or j are given, uses the substring s[i], s[i+1], ···, s[j].
The default value for i is 1; the default value for j is the number of characters in s.

## RETURN VALUE

Returns a string of the same same length as the original substring.

## EXAMPLE

> > >
foo = "ABCDEF" bar = foo:revert() print (foo, bar)
ABCDEF FEDCBA

## SEE ALSO

string.bitrevert, string.byterevert