// Tax-rate percent display — Sales Tax Task 3. The API returns rate percents
// as the numeric(7,4) text form ("7.2500", "1.0000"); the UI shows them
// trimmed ("7.25%", "1%"). Pure string surgery, never parseFloat — a percent
// isn't money, but the same no-float discipline (CLAUDE.md §2) costs nothing
// and keeps the value exactly what the database said.

/** "7.2500" -> "7.25", "1.0000" -> "1", "8.8750" -> "8.875". Display only —
 * the raw API string is what gets sent back on any save. */
export function trimPercent(raw: string): string {
  if (!raw.includes(".")) return raw;
  return raw.replace(/0+$/, "").replace(/\.$/, "");
}
