Skip to content

ProtoString unshuffle() Method

Seth Clydesdale edited this page Jun 1, 2015 · 1 revision

<< Back to Position Methods

Examples

unshuffling a shuffled string.

'gitsrn'.unshuffle(); // returns 'string'
'ticaajvsrp'.unshuffle(); // returns 'javascript'

Passing a number as the parameter will unshuffle the string n times.

'rgsnit'.unshuffle(3); // returns 'string'
'vipaartsjc'.unshuffle(4); // returns 'javascript'

Description

The unshuffle method reverses the results of the shuffle() method. For example, If a string has been shuffled 5 times, it should be unshuffled 5 times.

Syntax

String.unshuffle(n);

Parameters

Parameter Description
n A number that specifies the number of times a string should be unshuffled. Defaults to 1 if left undefined.
Clone this wiki locally