Re: Win getText of an integer

new topic     » goto parent     » topic index » view thread      » older message » newer message

--=====_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.&nbsp; This is how I solved it
for myself:</DIV>
<DIV>&nbsp;</DIV>
<DIV>Louis.</DIV>
<DIV>&nbsp;</DIV>
<DIV>-----------------------------------------------------------------<BR>-- s2n
-- Convert a numeric text string to an integer<BR>--&nbsp;&nbsp;&nbsp;Note: This
only works for positive 
integers<BR>-----------------------------------------------------------------<BR>global
function s2n(sequence s)<BR>&nbsp;&nbsp; atom n<BR>&nbsp;&nbsp; s -= '0'&nbsp;--
Convert ASCII to BCD<BR>&nbsp;&nbsp; n = s[1]&nbsp;-- First 
digit<BR>&nbsp;&nbsp; for i = 2 to length(s) 
do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n = n*10 + s[i]&nbsp;-- The rest of the 
digits<BR>&nbsp;&nbsp; end for<BR>&nbsp;return n&nbsp;-- 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"&nbsp; in Euphoria? 
  Windows</FONT></DIV>


--=====_106571978526111=_--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu