Angular 2+ String Helper
Just a simple lightweight Angular 2+ string helper
Installation
Install via npm
$ npm i ngx-string-helper --save
API Usage
To use it in your Angular 2 app import the module in your root module(app.module.ts) as shown below.
import { NgxStringHelperModule } from 'ngx-string-helper';
...
...
@NgModule({
imports:[
NgxStringHelperModule
],
})
In your components simply import the service.
import { NgxStringHelper } from 'ngx-string-helper';
...
...
export class YOUR_MODULE {
constructor(private ngxStringHelper: NgxStringHelper) {
console.log(ngxStringHelper.isNullOrEmpty(''));
}
}
Str.isNullOrEmpty();
let sampleString = "This is a sample string";
let isNullOrEmpty = ngxStringHelper.isNullOrEmpty(sampleString);
console.log(isNullOrEmpty);
Thanks and enjoy!