Skip to content

BorderTech/java-sanitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-sanitizer

Java utilities to perform common sanitization tasks on (user) input, e.g. translate "special symbols" to plain ascii characters.

The most common intended use case is sanitizing input which has been copied and pasted from Microsoft Word before being passed to a system architected in the second millenium of the Common Era.

Status

javadoc.io Build Status Codacy Badge

Usage

In your pom.xml:

<dependency>
  <groupId>com.github.bordertech.sanitizer</groupId>
  <artifactId>sanitizer</artifactId>
  <version>1.0.1</version>
</dependency>

Example usage:

String in = "Glass \u00BD full. \u00BC + \u00BE = 1";
System.out.println(Symbols.asciifySymbol(in));
// prints "Glass 1/2 full. 1/4 + 3/4 = 1"

See the unit tests for more examples: SymbolsTest.java

Building

If you wish to build this project you will need Apache Maven installed.

Run these commands to fetch the source and build:

  1. git clone https://github.com/bordertech/java-sanitizer.git
  2. cd java-sanitizer
  3. mvn install