Re: Win getText of an integer
- Posted by Louis at cwshop.com
Oct 09, 2003
--=====_106571978526111=_
I'm not sure that value() does what you want. This is how I solved it for=
myself:
Louis.
-----------------------------------------------------------------
-- s2n -- Convert a numeric text string to an integer
-- Note: This only works for positive integers
-----------------------------------------------------------------
global function s2n(sequence s)
atom n
s -=3D '0' -- Convert ASCII to BCD
n =3D s[1] -- First digit
for i =3D 2 to length(s) do
n =3D n*10 + s[i] -- The rest of the digits
end for
return n -- Return the number
end function
*********** REPLY SEPARATOR ***********
On 10/8/2003 at 10:01 PM sixs at ida.net wrote:
I want to enter a number into a windows program ,
Is there a "getInteger" in Euphoria? Windows
JVandal
--=====_106571978526111=_
Content-Type: text/html; charset="us-ascii"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>I'm not sure that value() does what you want. This is how I solved it
for myself:</DIV>
<DIV> </DIV>
<DIV>Louis.</DIV>
<DIV> </DIV>
<DIV>-----------------------------------------------------------------<BR>-- s2n
-- Convert a numeric text string to an integer<BR>-- Note: This
only works for positive
integers<BR>-----------------------------------------------------------------<BR>global
function s2n(sequence s)<BR> atom n<BR> s -= '0' --
Convert ASCII to BCD<BR> n = s[1] -- First
digit<BR> for i = 2 to length(s)
do<BR> n = n*10 + s[i] -- The rest of the
digits<BR> end for<BR> return n -- Return the
number<BR>end function</DIV>
<DIV><BR><FONT face=Arial size=2>*********** REPLY SEPARATOR
***********<BR><BR>On 10/8/2003 at 10:01 PM sixs at ida.net wrote:</FONT></DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px
solid"><PRE>============ The Euphoria Mailing List ============
</PRE>
<DIV><FONT face=Arial size=2>I want to enter a number into a windows program
,</FONT></DIV>
<DIV><FONT face=Arial size=2>Is there a "getInteger" in Euphoria?
Windows</FONT></DIV>
--=====_106571978526111=_--
|
Not Categorized, Please Help
|
|