Meridianmeridian

Currency Amount (ISO Code Prefix)

finance.currency.amount_code_prefix

ISO 4217 three-letter currency code as prefix, followed by amount. Standard in SWIFT messages, banking/FX systems, and international financial data. Separator conventions vary by currency.

Domain
finance
Category
currency
Casts to
VARCHAR
Scope
Universal

Try it

CLI
$ finetype infer -i "USD 1,234.56"
→ finance.currency.amount_code_prefix

DuckDB

Detect
SELECT finetype('USD 1,234.56');
-- → 'finance.currency.amount_code_prefix'
Cast expression
CAST(REGEXP_REPLACE(REGEXP_REPLACE({col}, '^[A-Z]{3}\s?', ''), ',', '') AS DECIMAL(18,2))
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS VARCHAR) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'finance.currency.amount_code_prefix';

Struct Expansion

Expression
currency_code: REGEXP_EXTRACT({col}, '^([A-Z]{3})')
numeric_value: CAST(REGEXP_REPLACE(REGEXP_REPLACE({col}, '^[A-Z]{3}\s?', ''), ',', '') AS DECIMAL(18,2))

JSON Schema

finetype schema finance.currency.amount_code_prefix
{
  "$id": "https://meridian.online/schemas/finance.currency.amount_code_prefix",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "ISO 4217 three-letter currency code as prefix, followed by amount. Standard in SWIFT messages, banking/FX systems, and international financial data. Separator conventions vary by currency.",
  "examples": [
    "USD 1,234.56",
    "EUR 1.234,56",
    "GBP 999.99",
    "JPY 10,000"
  ],
  "pattern": "^[A-Z]{3}\\s?-?[0-9]{1,3}([,.]?[0-9]{3})*(\\.[0-9]{1,2})?$",
  "title": "Currency Amount (ISO Code Prefix)",
  "type": "string",
  "x-finetype-broad-type": "VARCHAR",
  "x-finetype-transform": "CAST(REGEXP_REPLACE(REGEXP_REPLACE({col}, '^[A-Z]{3}\\s?', ''), ',', '') AS DECIMAL(18,2))"
}

Examples

USD 1,234.56EUR 1.234,56GBP 999.99JPY 10,000

Aliases

iso_code_amount