Skip to content

Latest commit

 

History

History
62 lines (31 loc) · 1.31 KB

README.md

File metadata and controls

62 lines (31 loc) · 1.31 KB

jString.js

jString is a javascript library extending String object with frequently needed methods.

Read more @ hmkcode.com.

How to Include jString.js in your HTML File

  • Download the jstring.js

  • Add it in the HTML file

<script src="jstring.js" type="text/javascript" language="javascript"></script>

  • Congratulations! your String has more methods

jString.js Methods

( 1 ) String.contains()

"normal string".contains("t") \\ return true

( 2 ) String.count()

"normal text".count("t"); \\ return 2

( 3 ) String.capitalize()

"normal TEXT".capitalize(); \\ return "Normal text"

( 4 ) String.trim()

" normal text ".trim(); \\ return "normal text"

( 5 ) String.leftTrim()

" normal text".leftTrim(); \\ return "normal text"

( 6 ) String.rightTrim()

"normal text ".rightTrim(); \\ return "normal text"

( 7 ) String.clear()

clear: will trim() + remove (+1) white-spaces in between

" normal text ".clear(); \\ return "normal text"

( 8 ) String.startsWith()

"normal text".startsWith("nor"); \\ return true

( 9 ) String.endsWith()

"normal text".endsWith("ext"); \\ return true

( 10 ) String.insert()

"normal text".insert("X", 4); \\ return "normXal text"