Skip to content

Main content

Identifier Whitespace Normalization Disclosure Tool

Calculate identifier whitespace normalization disclosure from explicit caller-supplied inputs.

Loading tool…

Description

Remove all JavaScript whitespace characters when removeInternal is true, otherwise trim only the ends.

Text comparison depends on the character policy used. Whitespace changes and Unicode normalization can alter a string even when parts of it look similar. An explicit transformation or status check makes that policy visible without establishing that two identifiers have the same real-world meaning.

Remove all JavaScript whitespace characters when removeInternal is true, otherwise trim only the ends.

When to use this tool

Use Identifier Whitespace Normalization Disclosure when you need to disclose or test the selected character transformation before comparing text.

How to use the tool and how it works

  1. Enter token, removeInternal. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read normalized, changed, removed. Inspect changed before interpreting the associated values.

Remove all JavaScript whitespace characters when removeInternal is true, otherwise trim only the ends. Return normalized, changed, and removed as the original-minus-result UTF-16 length.1

Input fieldMeaning and unitsAccepted input
tokenTokenRequired. Text; maximum UTF-16 length 8192.
removeInternalRemove InternalRequired. Boolean.
Output fieldInterpretationReturned shape
normalizedNormalizedRequired. Text; maximum UTF-16 length 8192.
changedChangedRequired. Boolean.
removedNumber of removed UTF-16 code units.Required. Safe integer.
json
{
  "input": {
    "token": " AB 12 ",
    "removeInternal": true
  },
  "output": {
    "normalized": "AB12",
    "changed": true,
    "removed": 3
  }
}

Limitations and assumptions

  • Removed counts code units, not grapheme clusters, and JavaScript whitespace is the selected character policy. This does not validate an identifier or establish that whitespace removal preserves its meaning.
  • The field tables state structural bounds; the mechanics also specify cross-field constraints. Malformed inputs and unsupported domains cause errors. A successful false flag, empty branch value, or zero placeholder has the meaning stated above and is distinct from an input error.

Alternative or Complementary methods

Choose the character policy explicitly before comparing or transforming identifiers. Inspect the original text when normalization or whitespace removal could change its meaning.

References

  1. Calculation and input contract: validate/identifier-whitespace-normalization-disclosure — tool.io

Similar or alternative tools