StringUtils for splitting and joining strings with support for separatorCharacter and escapeCharacter.
npm install string-split-join- About
- Installation
- Documentation
- Development
- License
StringUtils for splitting and joining strings with support for separatorCharacter and escapeCharacter.
Install through npm:
```
npm install --save string-split-join
Use it like:
`typescript
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' ]
}
}
`
`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
$3
* Install Node.js and yarn
* Install local dev dependencies: yarn while current directory is this repo$3
Run yarn start to start a development server on port 8000 with auto reload + tests.$3
Run yarn test to run tests once or yarn run test:watch to continually run tests.$3
* Bump the version in package.json (once the module hits 1.0 this will become automatic)
`bash
yarn run release
``MIT