Negative Parentheses Accounting Parser
Convert one parenthesized unsigned accounting decimal with optional boundary currency symbol into an exact negative decimal, using explicit decimal and grouping separators.
Description
Accounting exports sometimes use parentheses to show a negative amount instead of a minus sign.
Accounting exports sometimes use parentheses to show a negative amount instead of a minus sign. A parser must also know the decimal and grouping conventions to distinguish a fractional value from a thousands-separated integer.1
Convert one parenthesized unsigned accounting decimal with optional boundary currency symbol into an exact negative decimal, using explicit decimal and grouping separators.
When to use Negative Parentheses Accounting Parser
Use this tool to convert one parenthesized unsigned accounting decimal with optional boundary currency symbol into an exact negative decimal, using explicit decimal and grouping separators.
Choose the original CSV text, decoded cell strings, byte values or counts requested by this tool. Use the stated delimiter, encoding, indexing and number/date convention.
How to use Negative Parentheses Accounting Parser and understand its results
- Choose the original CSV text, decoded cell strings, byte values or counts requested by this tool. Use the stated delimiter, encoding, indexing and number/date convention.
- Enter text, decimalSeparator, groupingSeparator using the field table and calculation rules, then run the tool.
- Read value. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| text | Text | string; maximum length: 200 | Required |
| decimalSeparator | Decimal separator | string; one of ., , | Required |
| groupingSeparator | Grouping separator | string; one of , ,, ., | Required |
Enter a complete parenthesized token and distinct decimal and grouping separators. Outer whitespace is trimmed, both parentheses are required, and at most one boundary Unicode currency symbol is removed from the interior. The remaining decimal must be unsigned; an explicit plus or minus sign is rejected. Grouping, when present, requires a one-to-three-digit first group followed by three-digit groups. Exact integer-coefficient arithmetic produces a canonical negative decimal string, with zero returned as 0.
value = −(unsigned decimal coefficient × 10^(−scale)) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| value | Value | string |
{
"input": {
"text": "($1,234.50)",
"decimalSeparator": ".",
"groupingSeparator": ","
},
"output": {
"value": "-1234.5"
}
} Limitations and assumptions
Currency names and codes, exponent notation, nested parentheses and guessed separator conventions are unsupported. The result is text rather than a floating-point number; this does not determine an actual currency or exchange value.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use Currency Symbol Strip to Number: Remove at most one leading or trailing Unicode currency symbol and parse an exact decimal using explicit decimal and grouping separators; embedded symbols are rejected. For a complementary task, use Accounting Dash-for-Zero Normalizer: Replace cells consisting of a trimmed ASCII accounting dash with the exact string 0, preserving all other cell text including numeric signs and Unicode dashes.
References
-
Negative Parentheses Accounting Parser — tool.io
Similar or alternative tools
- Currency Symbol Strip to Number
Remove at most one leading or trailing Unicode currency symbol and parse an exact decimal using explicit decimal and grouping separators; embedded symbols are rejected.
- Accounting Dash-for-Zero Normalizer
Replace cells consisting of a trimmed ASCII accounting dash with the exact string 0, preserving all other cell text including numeric signs and Unicode dashes.