Code Clinic - HL7 Lab - Book 2: Strings Up Close
An HL7 message arrives as one long string. Before you can break it apart you have to read it closely, and that is what this book trains. It treats a string as what it really is, a sequence of characters you can reach into by position, counting forwards from zero and backwards from the end with negative indexing so the last character is always within reach. len() measures a value, and you use that measurement as a test: a date field that should be eight characters long and is not tells you something is wrong before it reaches a record. The in keyword answers whether a piece of text is present at all, find() tells you where it sits, and startswith() and endswith() let you check the beginning or the end of a line, which is how you recognise a segment by its three-letter name. The book closes on cleaning, using strip() to remove the stray spaces and line endings that real data always carries, and the case tools that make a comparison work whichever way the sender typed it.
Twenty-one A4 pages, in full colour. Written in short sentences and plain English, for readers whose first language is not English and clearer for everyone else because of it.
Every code example in this book was run before the page was printed, so the output you read is the output you get. Instant PDF download. By M.R. Sterling.