Skip to content

lucasb/idbase62

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ID Base62

Build Status Coverage Status

Project to generate sequential identification with base 62.

This lib helps generate short identifications to use in friendly URLs. For building IDs, it is using Base 62 that is all ASCII letters (upper and lower case) [a-z A-Z] and numbers [0-9].

  ID decimal: 1413324470488
  ID Base62:  ySHP1FC

Using as ID in Entity

You can use it like a type in your Java Object to get new IDs private Identification id;.

  • next() method allows you to get next one in sequence;
  • before() method allows you to get before one in sequence;
  • equals() method to test if to values is equals.

Calculating with Base 62

The Base62 class has methods to calculate Base62 elements and convert from/to Base10.

  • fromDecimal() convert from decimal to Base62;
  • toDecimal() convert from Base62 to decimal;
  • isValid() verify if value is a valid Base62 element;
  • plus() sum two Base62 elements;
  • minus() subtract two Base62 elements.

License

The project idbase62 is licensed under the Apache license version 2.0.

Copyright 2015 idbase62

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Project to generate sequential identification with base 62.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages