@stdlib/slice-base-slice2seq
v0.2.2
Published
Convert a Slice object to a subsequence string.
Downloads
23
Readme
slice2seq
Convert a
Slice
object to a subsequence string.
Installation
npm install @stdlib/slice-base-slice2seq
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'
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.