slice2seq
Convert a
Slice
object to a subsequence string.
Usage
var slice2seq = require( '@stdlib/slice/base/slice2seq' );
slice2seq( str )
Converts a Slice
object to a subsequence string.
var Slice = require( '@stdlib/slice/ctor' );
var str = slice2seq( new Slice( 0, 5, 1 ) );
// returns '0:5:1'
Examples
var Slice = require( '@stdlib/slice/ctor' );
var slice2seq = require( '@stdlib/slice/base/slice2seq' );
var str = slice2seq( new Slice( null, null, null ) );
// returns ':'
str = slice2seq( new Slice() );
// returns ':'
str = slice2seq( new Slice( null ) );
// returns ':'
str = slice2seq( new Slice( 10 ) );
// returns ':10'
str = slice2seq( new Slice( -1 ) );
// returns ':-1'
str = slice2seq( new Slice( 2, 10 ) );
// returns '2:10'
str = slice2seq( new Slice( -2, 10 ) );
// returns '-2:10'
str = slice2seq( new Slice( -2, -10 ) );
// returns '-2:-10'
str = slice2seq( new Slice( 2, null ) );
// returns '2:'
str = slice2seq( new Slice( null, 10 ) );
// returns ':10'
str = slice2seq( new Slice( 2, 10, 2 ) );
// returns '2:10:2'
str = slice2seq( new Slice( -1, null, -1 ) );
// returns '-1::-1'
str = slice2seq( new Slice( -1, -5, -1 ) );
// returns '-1:-5:-1'
str = slice2seq( new Slice( -1, 10, -1 ) );
// returns '-1:10:-1'
str = slice2seq( new Slice( 1, -1, 2 ) );
// returns '1:-1:2'
str = slice2seq( new Slice( null, null, -1 ) );
// returns '::-1'