For Programmers: Free Programming Magazines  


Home > Archive > Prolog > December 2004 > extracting a leading floating point number out of a string









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author extracting a leading floating point number out of a string
news.uni-bamberg.de

2004-12-17, 3:56 am

Hello,

is there s simple way to get the leading floating point number out of a
string with trailing characters like "123.32cm"?
Many thanks

Cornelius


Bart Demoen

2004-12-17, 8:56 am

news.uni-bamberg.de wrote:
> Hello,
>
> is there s simple way to get the leading floating point number out of a
> string with trailing characters like "123.32cm"?
> Many thanks
>
> Cornelius
>
>


The following might not solve your problem in general, but how about starting from:


| ?- append(F,[0'.|_],"123.32cm"), name(I,F).
F = [49,50,51],
I = 123 ?


Cheers

Bart Demoen
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com