# String - [`leftpad`](#leftpad) - [`rightpad`](#rightpad) - [`pad`](#pad) - [`trim`](#trim) - [`split`](#split) - [`replace`](#replace) - [`match`](#match) - [`test`](#test) - [`newlines`](#newlines) - [`capitalize`](#capitalize) - [`upperfirst`](#upperfirst) - [`template`](#template) - [`encodeURI`](#encodeuri) - [`encodeURIComponent`](#encodeuricomponent) - [`decodeURI`](#decodeuri) - [`decodeURIComponent`](#decodeuricomponent) - [`repeat`](#repeat) - [`truncate`](#truncate) - [`slugify`](#slugify) - [`stripTags`](#striptags) - [`latinize`](#latinize) - [`wrap`](#wrap) - [`with`](#with) - [`reverseStr`](#reversestr) You can check the module import [`here`](./modules.md). #### leftpad Returns a left-padded string. ##### File ```typescript import { NgLeftPadPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'aaa' | leftpad: 4 }} {{ 'aaa' | leftpad: 3 }} {{ 'aaa' | leftpad: 5: 'b' }} ``` #### rightpad Returns a right-padded string. ##### File ```typescript import { NgRightPadPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'aaa' | rightpad: 4 }} {{ 'aaa' | rightpad: 3 }} {{ 'aaa' | rightpad: 5: 'b' }} ``` #### pad Returns a padded string. It starts with left and then right. ##### File ```typescript import { NgPadPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'aaa' | pad: 4 }} {{ 'aaa' | pad: 5 }} {{ 'aaa' | pad: 5: 'b' }} ``` #### trim Trims the string. ##### File ```typescript import { NgTrimPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'aaa' | trim }} {{ 'aaa ' | trim }} {{ ' aaa ' | trim }} ``` #### split Split a string into an array. ##### File ```typescript import { NgSplitPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'Hello World' | split }} {{ 'ABABA' | split: 'B' }} {{ 'ABABA' | split: 'B': 2 }} ``` #### replace This is the `String#replace()` function, if you want to know more about the arguments, check the official documentation. ##### File ```typescript import { NgReplacePipeModule } from 'angular-pipes'; ``` #### match This is the `String#match()` function, if you want to know more about the arguments, check the official documentation. ##### File ```typescript import { NgMatchPipeModule } from 'angular-pipes'; ``` #### test This is the `String#test()` function, if you want to know more about the arguments, check the official documentation. ##### File ```typescript import { NgTestPipeModule } from 'angular-pipes'; ``` #### newlines Replaces the `\n`, `\r` and `\r\n` into `
`. This function returns HTML so you need to use it with the `[innerHTML]` binding. ##### File ```typescript import { NgNewlinesPipeModule } from 'angular-pipes'; ``` ##### Usage ```javascript this.value = 'Hello, World. \nHow are you ?'; ``` ```html ``` #### capitalize Capitalize the string. If the argument is true, all the words will be capitalized. ##### File ```typescript import { NgCapitalizePipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'hello world' | capitalize }} {{ 'hello world' | capitalize: true }} {{ 'hELLo wOrld' | capitalize: true }} ``` #### upperfirst Uppercase the first letter. ##### File ```typescript import { NgUpperFirstPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'hello world' | upperfirst }} ``` #### template Template string. ##### File ```typescript import { NgTemplatePipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ "Hello $1, it's $2" | template: 'world': 'me' }} ``` #### encodeuri The encodeURI function. ##### File ```typescript import { NgEncodeURIPipeModule } from 'angular-pipes'; ``` #### encodeuricomponent The encodeURIComponent function. ##### File ```typescript import { NgEncodeURIComponentPipeModule } from 'angular-pipes'; ``` #### decodeuri The decodeURI function. ##### File ```typescript import { NgDecodeURIPipeModule } from 'angular-pipes'; ``` #### decodeuricomponent The decodeURIComponent function. ##### File ```typescript import { NgDecodeURIComponentPipeModule } from 'angular-pipes'; ``` #### repeat Repeats a string. ##### File ```typescript import { NgRepeatPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'a' | repeat: 2 }} {{ 'a' | repeat: 2: 'b' }} ``` #### truncate Truncate a string. Arguments: \(size, suffix, preserve\) ##### File ```typescript import { NgTruncatePipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'Hello World' | truncate: 4 }} {{ 'Hello World' | truncate: 4: '': true }} {{ 'Hello World' | truncate: 4: '...': true }} {{ 'Hello World, how is it going?' | truncate: 14: '...': true }} ``` #### slugify Slugify a string. Arguments: \(string\) ##### File ```typescript import { NgSlugifyPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'The zombie world war began' | slugify }} ``` #### striptags strip out html tags from string **Important: this Pipe jobs it's not to replace innerHtml directive, it's only for tiny plain text** Arguments: \( string, ends, case-sensitive\[optional\] \) ##### File ```typescript import { NgStripTagsPipeModule } from 'angular-pipes'; ``` ##### Usage ```html var text = '

Lorem Ipsum is simply dummy text of the printing...

';

{{ text | stripTags }}

``` #### latinize Remove accents/diacritics from a string ##### File ```typescript import { NgLatinizePipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'Sòme strÏng with Âccénts' | latinize }} ``` #### wrap Wrap a string with another string Arguments: \( string, string, string\[optional\] \) ##### File ```typescript import { NgWrapPipeModule } from 'angular-pipes'; ``` ##### Usage ```html

{{ 'foo' | wrap: '/' }}

{{ 'foo' | wrap: '{{': '}}' }}

``` #### with With pipe check string has start and/or ends Arguments: \( string, start\[optional\], ends\[optional\], case-sensitive\[optional\] \) ##### File ```typescript import { NgWithPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{'The Flash Reverse' | with: 'The' : null, true}} {{'The Flash Reverse' | with: 'The' : 'Reverse' : true}} {{'The Flash Reverse' | with: 'The' : 'Reverse'}} {{'The Flash Reverse' | with: 'the' : 'reverse'}} {{'The Flash Reverse' | with: 'the' : 'Reverse' : true}} {{'The Flash Reverse' | with: 'the' : 'reverse' : true}} {{'The Flash Reverse' | with: 'Blue' : 'Reverse' : true}} {{'The Flash Reverse' | with: 'The' : 'Black' : true}} {{'The Flash Reverse' | with: '' : 'Black' : true}} {{'The Flash Reverse' | with: '' : '' : true}} {{'The Flash Reverse' | with: null : null : true}} {{'The Flash Reverse' | with: null : null}} {{'The Flash Reverse' | with}} ``` #### reversestr Reverse a string. ##### File ```typescript import { NgReverseStrPipeModule } from 'angular-pipes'; ``` ##### Usage ```html {{ 'hello world' | reverseStr }} ```