Skip to content

Main content

CSS Number Token Sign Normalizer

Normalize only an explicit plus sign on a strict CSS numeric spelling while retaining decimal scale and negative-zero evidence; not unit parsing.

Loading tool…

Description

Remove a leading plus from the supported decimal-number subset while preserving scale and negative-zero spelling; units and leading-dot numbers are rejected.

CSS combines token syntax, property-specific value rules and layout/cascade processing. These are separate layers: splitting a declaration does not establish that its value is valid, and arithmetic on resolved lengths does not perform browser layout. Each tool here handles an explicit numeric representation or a stated lexical subset.

Remove a leading plus from the supported decimal-number subset while preserving scale and negative-zero spelling; units and leading-dot numbers are rejected.

When to use this tool

Use this tool to remove a leading plus from the supported decimal-number subset while preserving scale and negative-zero spelling; units and leading-dot numbers are rejected.

How to use the tool and how it works

  1. Enter token using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.normalized, result.negativeZero. Interpret signs, units, ordering and null values using the rules below.

Require the complete restricted numeric spelling: optional sign, at least one integer digit, optional dot followed by one or more fractional digits, and optional exponent. Parse the exact decimal value to detect zero, remove only a leading plus, and retain all other spelling including scale and a leading minus.1, 2

Input fieldMeaning and unitsAccepted input
tokenOne isolated numeric or identifier token in the exact supported grammar.Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply.
Output fieldInterpretation
resultObject containing the fields below.
result.normalizedOriginal numeric spelling with only a leading plus removed.
result.negativeZeroWhether exact decimal value is zero and the source spelling begins with minus.
json
{
  "input": {
    "token": "+01.20"
  },
  "output": {
    "result": {
      "normalized": "01.20",
      "negativeZero": false
    }
  }
}

Limitations and assumptions

  • Units, percentages, a leading decimal point such as .5, and a trailing dot such as 1. are rejected. Text is at most 256 UTF-16 units and fractional-digit count minus exponent must be within −256…256; this is not canonical numeric formatting.
  • Lengths and times must already be resolved to consistent numeric units. Lexical helpers intentionally support smaller grammars than a full browser CSS parser; malformed supported-subset input causes an error.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Use a full CSS parser or browser style/layout APIs when escape handling, error recovery, computed styles or the full cascade matter. These tools expose focused transformations and audits of supplied data.

References

  1. CSS Syntax Level 3 — W3C

  2. Tool behavior and example: CSS Number Token Sign Normalizer — tool.io

Similar or alternative tools

  • CSS Identifier Escape Token Decoder

    Decode CSS identifier escape sequences to Unicode scalars with replacement for zero/surrogate/out-of-range code points; requires an already isolated identifier token, not full identifier grammar.

  • CSS Custom Property Name Token Audit

    Audit a deliberately restricted ASCII custom-property token grammar -- followed by letters/digits/underscore/dash; not full CSS identifier validation.