Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-tools

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-tools

Some useful functions for working with strings

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

view on npm npm module downloads per month Build Status Dependency Status

string-tools

Example

var s = require("string-tools");

s.symbol

some cross platform symbols (tick and cross)

Kind: static property of string-tools

s.escapeRegExp()

escape special regular expression characters

Kind: static method of string-tools
Example

> s.escapeRegExp("(.*)");
'\\(\\.\\*\\)'

s.fill(fillWith, len) ⇒ string

Create a new string filled with the supplied character

Kind: static method of string-tools

ParamTypeDescription
fillWithstringthe fill character
lennumberthe length of the output string

Example

> s.fill("a", 10)
'aaaaaaaaaa'
> s.fill("ab", 10)
'aaaaaaaaaa'

s.padRight(input, width, [padWith]) ⇒ string

Add padding to the right of a string

Kind: static method of string-tools

ParamTypeDefaultDescription
inputstringthe string to pad
widthnumberthe desired final width
[padWith]string"" ""the padding character

Example

> s.padRight("clive", 1)
'clive'
> s.padRight("clive", 1, "-")
'clive'
> s.padRight("clive", 10, "-")
'clive-----'

s.repeat(input, times) ⇒ string

returns the input string repeated the specified number of times

Kind: static method of string-tools

ParamTypeDescription
inputstringinput string to repeat
timesnumberthe number of times to repeat

s.clipLeft(input, width, [prefix]) ⇒ string

returns the input string clipped from the left side in order to meet the specified width

Kind: static method of string-tools

ParamTypeDefaultDescription
inputstringinput string to repeat
widthnumberthe desired final width
[prefix]string"..."the prefix to replace the clipped region

© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

Keywords

FAQs

Package last updated on 20 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc