javascript : String.trimAll()

 

javascript : String.trimAll()


Target:

Applicable with String Data Type.


Description :

remove all extra spaces, tabs and new line characters from string and return string with single space between words.



Syntax:

String.trimAll()


Usase:

  1. " hello     how     are     you? ".trimAll()
    It return string "hello how are you?"
  2. `MYJS
    (Make Your Java Scripting Easy)
    A     Library     of     Javascript     Extension     Methods
    [This library add many dom prototype extension methods to make easy javascript coding.]`.trimAll()
    "MYJS(Make Your Java Scripting Easy)A Library of Javascript Extension Methods[This library add many dom prototype extension methods to make easy javascript coding.]"
  3. var multiLineString=`line1
                        line2
                        line3`;
    multiLineString.trimAll();
    "line1 line2 line3"


Download MYJS.js

MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type. 

Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

Comments

Popular posts from this blog

javascript : String.right

javascript : String.left

javascript : .nextAll()