time-to-botec/js/node_modules/@stdlib/string/remove-utf8-bom/README.md
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

2.6 KiB

Remove UTF-8 BOM

Remove a UTF-8 byte order mark (BOM) from the beginning of a string.

Usage

var removeUTF8BOM = require( '@stdlib/string/remove-utf8-bom' );

removeUTF8BOM( str )

Removes a UTF-8 byte order mark (BOM) from the beginning of a string.

var str = removeUTF8BOM( '\ufeffbeep' );
// returns 'beep'

Examples

var removeUTF8BOM = require( '@stdlib/string/remove-utf8-bom' );

var str = removeUTF8BOM( '\ufeffbeep' );
// returns 'beep'

str = removeUTF8BOM( 'boop\ufeff' );
// returns 'boop\ufeff'

str = removeUTF8BOM( 'be\ufeffbop' );
// returns 'be\ufeffbop'

str = removeUTF8BOM( 'foobar' );
// returns 'foobar'

CLI

Usage

Usage: remove-utf8-bom [options] [<string>]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

Assuming a shell which understands escape sequences,

$ remove-utf8-bom "\xEF\xBB\xBFbeep boop"
beep boop

To use as a standard stream,

$ echo -n '\ufeffbeep' | remove-utf8-bom
beep