https://github.com/stefh/string-split-join
StringUtils for splitting and joining strings with support for separatorCharacter and escapeCharacter.
https://github.com/stefh/string-split-join
join node split string string-manipulation
Last synced: about 1 year ago
JSON representation
StringUtils for splitting and joining strings with support for separatorCharacter and escapeCharacter.
- Host: GitHub
- URL: https://github.com/stefh/string-split-join
- Owner: StefH
- License: mit
- Created: 2017-03-28T11:12:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-15T09:30:58.000Z (almost 9 years ago)
- Last Synced: 2024-04-13T21:28:07.834Z (about 2 years ago)
- Topics: join, node, split, string, string-manipulation
- Language: TypeScript
- Size: 966 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# string-split-join
[](https://greenkeeper.io/)
[](https://travis-ci.org/StefH/string-split-join)
[](https://codecov.io/gh/StefH/string-split-join)
[](http://badge.fury.io/js/string-split-join)
[](https://david-dm.org/StefH/string-split-join?type=dev)
[](https://github.com/StefH/string-split-join/issues)
[](https://github.com/StefH/string-split-join/stargazers)
[](https://raw.githubusercontent.com/StefH/string-split-join/master/LICENSE)
## Table of contents
- [About](#about)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)
## 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:
```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' ]
}
}
```
### Usage without a module bundler
```
// everything is exported StringUtils namespace
```
## Documentation
All documentation is auto-generated from the source via [compodoc](https://compodoc.github.io/compodoc/) and can be viewed here:
https://StefH.github.io/string-split-join/docs/
## Development
### Prepare your environment
* Install [Node.js](http://nodejs.org/) and [yarn](https://yarnpkg.com/en/docs/install)
* 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)
```bash
yarn run release
```
## License
MIT