URL Formatter
Assemble an absolute URL from its scheme, host, optional port, path, query and fragment parts.
Description
Assemble scheme, host, optional port, path, query, and fragment into one URL string.
URL Formatter assemble scheme, host, optional port, path, query, and fragment into one URL string.
Use this when URL components are already separated and need predictable joining without repeatedly handling punctuation.
When to use URL Formatter
Use this when URL components are already separated and need predictable joining without repeatedly handling punctuation.
How it works
The formatter inserts ://, normalizes the path to begin with a slash, and conditionally prefixes port, query, and fragment separators.1
Interpreting the result
Keep the input units, direction conventions, encoding, and ordering rules visible when reusing the result. Preserve the full returned value for downstream calculations and round only for presentation.
Assumptions and limitations
This is a component joiner, not a full URL validator or percent-encoder. Callers remain responsible for a valid host, scheme, component escaping, and protocol-specific restrictions.