Menu
hardLotus's · textBasic

Parse quantity and price out of receipt lines

Receipt lines arrive from the tills as one text blob per item, in the form 2x MILO 3in1 400g @ 12.90 — a quantity, then x, then the product description, then @ and the unit price.

Split each line into its parts and work out what each one came to.

Return receipt_id, the parsed product with no surrounding whitespace, qty, unit_price, and line_total (quantity times unit price).

Schema

receipt_lines
receipt_idINT
raw_lineTEXT

Basic

The example input, expected output, and walkthrough for this question unlock with a Basic plan.

↑ Read the question

Basic

This is a Basic question

Premium practice questions unlock with a Basic plan. The full solution, expected output, and grading are available to Basic members.

See Basic plans

RM 25/mo · cancel anytime

Keep going

Company names are trademarks of their respective owners, used here only to describe practice material. mahir_data is not affiliated with, endorsed by, or sponsored by any company named on this site. Terms.