Package Exports
- string-tools
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (string-tools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
#string-tools Some useful functions for working with strings
Contents
- symbol
- escapeRegExp()
- fill(fillWith, len)
- padRight(input, width, [padWith])
- repeat(input, times)
- clipLeft(input, width, [prefix])
###s.symbol
some cross platform symbols (tick
and cross
)
###escapeRegExp() escape special regular expression characters
####Example
> w.escapeRegExp("(.*)");
'\\(\\.\\*\\)'
###fill(fillWith, len) Create a new string filled with the supplied character
- fillWith
string
the fill character - len
number
the length of the output string
Returns: string
####Example
> w.fill("a", 10)
'aaaaaaaaaa'
> w.fill("ab", 10)
'aaaaaaaaaa'
###padRight(input, width, [padWith]) Add padding to the right of a string
- input
string
the string to pad - width
number
the desired final width - [padWith]
string
the padding character
Returns: string
####Example
> w.padRight("clive", 1)
'clive'
> w.padRight("clive", 1, "-")
'clive'
> w.padRight("clive", 10, "-")
'clive-----'
###repeat(input, times) returns the input string repeated the specified number of times
- input
string
input string to repeat - times
number
the number of times to repeat
Returns: string
###clipLeft(input, width, [prefix])
returns the input string clipped from the left side in order to meet the specified width
- input
string
input string to repeat - width
number
the desired final width - [prefix]
string
the prefix to replace the clipped region
Returns: string