Converting Numbers To Shorter/Easier to Convey Strings

johna by | October 18, 2007 | Classic ASP Web Development

These functions convert a number into a shorter string containing both text and numbers.

Possible uses include where you may have a reference number that you don't want to look as if it is sequential and easy to pick, and/or if you want a refernce number that people could quote easier (because it is shorter).

Basically, it converts the number into a Base-34 number (similar to hexadecimal which is Base-16, or binary which is Base-2. Decimal is Base-10).

An advantage to this script, however, is that it doesn't use the letter 'I' or the letter 'O' so there can never been any confusion between them and the numbers one and zero.

To call the script simply use ToBase34(your-number) to convert to the string, then FromBase34(converted-string) to convert back to decimal.

Show sample

Related Posts

Web Development

How to set up a debugging using the Turnkey Linux LAMP stack and VS Code

by johna | December 19, 2023
The second part in my guide to setting up a website and database using the Turnkey Linux LAMP stack.

Website Hosting Web Development

How to set up a website and database using the Turnkey Linux LAMP stack

by johna | November 18, 2023
If you need to host your own website for the purposes of web development, Turnkey Linux LAMP Stack is an easy to install all-in-one solution that you can set up on a spare computer or a VM (Virtual Machine).

Web Development

Intermittent "Unable to read data from the transport connection: net_io_connectionclosed" errors

by johna | May 6, 2020
If you are having intermittent problems sending email in .NET using System.Net.Mail consider switching libraries.

Comments

by Freeman | February 26, 2008

You make my day!

Reply

by Philip | July 31, 2009

Fantastic! Saved me tons of work!

Reply

Leave a Reply

About

...random postings about web development and programming, Internet, computers and electronics topics.

I recommend ASPnix for web hosting and Crazy Domains for domain registration.

Subscribe

Get the latest posts delivered to your inbox.