stringfu v0.0.10
String Fu
String manipulation and conversion functions including for working with bytes/hex strings.
Warning: This sofware is under construction and in pre-alpha state.
Example usage
import { reverseBytes } from 'stringfu';
console.log(reverseBytes('0FAB03')); // 03AB0FAPI
Table of Contents
- leftPad
- rightPad
- toBytes
- fromBytes
- reverseBytes
- containsOnly
- isInteger
- splitWidth
- isWhitespace
- isAlphaNumeric
leftPad
Takes a string and makes it length, left-padded with padChar
Parameters
rightPad
Takes a string and makes it length, right-padded with spaces
Parameters
toBytes
Takes a hex string and returns Uint8Array of bytes
Parameters
strstring
fromBytes
Takes an array of bytes and returns them as a string
Parameters
bytesUint8Array
reverseBytes
Takes a string of hexadecimal and returns a string with the bytes reversed
Parameters
strstring
containsOnly
Returns true if string only contains nominated chars
Parameters
isInteger
Returns true if string represents an integer number
Parameters
strstring String to check
splitWidth
Return a string as an array split at lineWidth chars
Parameters
Returns Array<string> Array of strings
isWhitespace
Checks if string contains only whitespace characters
Parameters
strstring String to check
Returns boolean True/false
isAlphaNumeric
Checks if string contains only alphanumeric characters
Parameters
strstring String to check
Returns boolean True if only alphanumeric