{"success":true,"name":"users-type-1-5-and-1-5-parse-numeric-input-by-locale-never-b","description":"Reading numbers users typed, in a region where decimals use commas","category":"ai-brimind","path":"ai-brimind/users-type-1-5-and-1-5-parse-numeric-input-by-locale-never-b/SKILL.md","file":"SKILL.md","content":"---\nname: users-type-1-5-and-1-5-parse-numeric-input-by-locale-never-b\ndescription: \"Reading numbers users typed, in a region where decimals use commas\"\n---\n\n# Users Type 1,5 and 1.5: Parse Numeric Input by Locale, Never Blind parseFloat\n\n## When to use\nA text field accepts numeric input (prices, quantities, measurements) and the code parses it with default float parsing, while users may write comma decimals or grouping separators.\n\n## Example request\nuser types 1,5 meaning one and a half → default parsing reads 1 and drops the rest; silently wrong by a third. 1.500 typed as one thousand five hundred (dot as grouping) → parsed as 1.5; thousandfold error. price '12,50 DT' pasted with currency → parse fails or truncates; unclean input. — each assumed the whole world writes numbers one way.\n\n## Instructions\nAct as a bank teller who confirms whether the customer's '1,500' means one-and-a-half or fifteen hundred before touching the account. Decimal and grouping separators swap meaning across regions — comma-decimal countries are the majority — and default parsing functions understand only the dot form, so they silently truncate or misread instead of failing loudly. For any human-typed number: decide which locale(s) the input may come in, normalize deliberately (strip currency symbols and spaces, resolve the separators to the canonical form) before parsing, and validate the result — reject what you cannot interpret unambiguously rather than guessing, because 1.500 is genuinely ambiguous without knowing the writer's convention. Prefer prevention at the field: numeric input modes, masks, or separate fields reduce the ambiguity before it reaches parsing. Symmetrically, display numbers back in the user's convention, not the code's. Test with 1,5 — 1.500 — a pasted value with currency and spaces — and confirm each is either correctly understood or explicitly refused. Only proceed once no typed number can be silently misread by a factor of ten, a thousand, or a dropped half.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #753\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}