Strings

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

------=_NextPart_000_00C6_01BF4299.B05BD0E0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I really want to stay out of the war over strings, but I thought I'd =
share the string type I use--easier to read than the others I've seen in =
these posts, but should be comparably efficient:

global type string(object theObject)
object temp
if not sequence(theObject) return 0 end if
for i=3D1 to length(theObject) do
    temp=3DtheObject[i]
    if not integer(temp) or temp<0 or temp>255 then return 0 end if=20
end for
return 1
end type

--Mike Nelson

------=_NextPart_000_00C6_01BF4299.B05BD0E0
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT color=3D#000000 size=3D2>I really want to stay out of the war =
over=20
strings, but I thought I'd share the string type I use--easier to read =
than the=20
others I've seen in these posts, but should be comparably=20
efficient:</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#000000 size=3D2>global type string(object=20
theObject)</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2></FONT><FONT size=3D2>object =
temp</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>if not sequence(theObject) return 0 =
end=20
if</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>for i=3D1 to length(theObject) =
do</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp;&nbsp;=20
temp=3DtheObject[i]</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>&nbsp;&nbsp;&nbsp; if not =
integer(temp) or=20
temp&lt;0 or temp&gt;255 then return 0 end if </FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>end for</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>return 1</FONT></DIV>
<DIV><FONT color=3D#000000 size=3D2>end type</FONT></DIV>
<DIV>&nbsp;</DIV>

------=_NextPart_000_00C6_01BF4299.B05BD0E0--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu