feuvpi / cutstr

A simple way to select substrings from strings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm version code style: prettier

CutStr

Write a project description

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.4.1
v8.16.0

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installation

To install and set up the library, run:

$ npm install cutstr

Or if you prefer using Yarn:

$ yarn add --dev custr

Usage

This package is can be used in situations where the index of the substring is not known, but the structure of the string is.

const cutStr = require('Cutstr')

string = "2016-12-21 00:00:00.000"

const day = cutStr(string, "-", " ", 2, 1);

console.log(day) //  21 

Authors

License

MIT License © Fred Vasquez

About

A simple way to select substrings from strings.

License:MIT License


Languages

Language:JavaScript 100.0%