string-split-join
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

string-split-join

Build Status codecov npm version devDependency Status GitHub issues GitHub stars GitHub license

Table of contents

About

StringUtils for splitting and joining strings with support for separatorCharacter and escapeCharacter.

Installation

Install through npm:

npm install --save string-split-join

Use it like:

import { StringUtils } from 'string-split-join';
 
export class Test {
  public test(): void {
    let result: string;
 
    // Joining
    result = StringUtils.join([ 'a', 'b', ':c', 'd']); // 'a:b:\\:c:d'
    result = StringUtils.join([ 'a', 'b', ':c', 'd'], { escapeChar: '$' });  // 'a:b:$:c:d'
    result = StringUtils.join([ 'a', 'b', '|c', 'd'], { separatorChar: '|', escapeChar: '$' }); // 'a|b|$|c|d'
 
    // Splitting
    let results: [];
    results = StringUtils.split('a:b:\\:c:d'); // ['a', 'b', ':c', 'd' ]
    results = StringUtils.split('a|b|c|d', { separatorChar: '|' }); // ['a', 'b', 'c', 'd' ]
    results = StringUtils.split('a|b|$|c|d', { separatorChar: '|', escapeChar: '$' }); // ['a', 'b', '|c', 'd' ]
  }
}

Usage without a module bundler

<script src="node_modules/string-split-join/bundles/string-split-join.umd.js"></script>
<script>
    // everything is exported StringUtils namespace
</script>

Documentation

All documentation is auto-generated from the source via compodoc and can be viewed here: https://StefH.github.io/string-split-join/docs/

Development

Prepare your environment

  • Install Node.js and yarn
  • Install local dev dependencies: yarn while current directory is this repo

Development server

Run yarn start to start a development server on port 8000 with auto reload + tests.

Testing

Run yarn test to run tests once or yarn run test:watch to continually run tests.

Release

  • Bump the version in package.json (once the module hits 1.0 this will become automatic)
yarn run release

License

MIT

/string-split-join/

    Package Sidebar

    Install

    npm i string-split-join

    Weekly Downloads

    478

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • stef.heyenrath