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

char-code-at

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

char-code-at

Get the char codes for any string passed in.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Table of Contents

  • Installation
  • Usage

char-code-at

A simple npm package to get the ASCII character codes of any string.

Installation

npm install char-code-at

Usage

CLI Tool

char-code-at can be used as a CLI tool. Most simply:

λ char-code-at Hi

CHAR: "H"               CHAR CODE: 72
CHAR: "i"               CHAR CODE: 105

You can also pass in whitespace:

λ char-code-at "Hi, world"

CHAR: "H"               CHAR CODE: 72
CHAR: "i"               CHAR CODE: 105
CHAR: ","               CHAR CODE: 44
CHAR: " "               CHAR CODE: 32
CHAR: "w"               CHAR CODE: 119
CHAR: "o"               CHAR CODE: 111
CHAR: "r"               CHAR CODE: 114
CHAR: "l"               CHAR CODE: 108
CHAR: "d"               CHAR CODE: 100

The --start or -s flag indicates the first index that will be analyzed:

λ char-code-at Hello -s 2

CHAR: "l"               CHAR CODE: 108
CHAR: "l"               CHAR CODE: 108
CHAR: "o"               CHAR CODE: 111

Conversely, the --end or -e flag indicates the last index that will be analyzed:

λ char-code-at Hello -e 2

CHAR: "H"               CHAR CODE: 72
CHAR: "e"               CHAR CODE: 101
CHAR: "l"               CHAR CODE: 108

Use both flags together to narrow your results even further:

λ char-code-at "Hi, world" -s 4 -e 5

CHAR: "w"               CHAR CODE: 119
CHAR: "o"               CHAR CODE: 111

Package

Access char-code-at functionality from your JavaScript or TypeScript code. To start, require the package:

const charCodeAt = require('../char-code-at');

Then, in your code pass in 1. The string to analyze, 2. The first index to analyze, and 3. The last index to analyze.

charCodeAt.printCharCodes("Hi, world", 4, 5);

FAQs

Package last updated on 02 May 2019

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