parsing measurements

Alan Baljeu <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
What's the easiest way to code parse_measure?

?- parse_measure('3.4mm/kg', N, U), N == 3.4, U == (mm/kg).


It seems like a trivial problem given built-in stuff to parse numbers, and stuff to convert text into terms, but I can't find anything that will help identifying and pulling out the number, neither a scanf equivalent nor something that splits an atom over certain text.
 
Alan Baljeu

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.