Length Validator

Sanitize, convert and validate linear units

Description

This page simply validates linear units of measure. I built it to test my sanitizion, validation & conversion code. Similar to latitude and longitude, I want to:

  • Trim whitespace; Strip slashes; Convert HTML special characters.
  • Allow negatives (for now).
  • Trim leading zeros: "-005.5" --> "-5.5".
  • Round to three places past the decimal
  • Begin with zero: ".6" --> "0.6".
  • Correct negative zero: "-0" --> "0".
  • Accept floating point values less than the diameter of Earth (12,742 km)

Input

Outputs