Code Monkey home page Code Monkey logo

value-shortener's Introduction

Integer value shortener

This is an integer value shortener into a string-like value, including a decoding method for retieving the original value. Basically the script only transform numbers between base-10 positional notation and any positional numeral system provided; list of allowed characters needs to be provided with funciton calls.

Character set

The only limitation on character set provided is uniqueness of a character within a set (otherwise the decoding into base-10 notation is not possible).

Examples

Following examples are using all numbers and case-sensitive latin letters as character set, i.e., base-62 notation.

Character set being used:
	0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

Input number: 1256205909 
Shortened output: 1n0UxD 
Reverse check: 1256205909 

Input number: 1396059841 
Shortened output: 1wtIWd 
Reverse check: 1396059841 

Input number: 1726829042 
Shortened output: 1SRB7k 
Reverse check: 1726829042 

Input number: 329437870 
Shortened output: mihQ2 
Reverse check: 329437870 

Input number: 2107777486 
Shortened output: 2iE1d4 
Reverse check: 2107777486 

Input number: 224550586 
Shortened output: fcbRE 
Reverse check: 224550586 

Disclaimer

The code was originally written several years ago :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.