String Type Comment

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

>>Here's Jeff's winning (modified) string type:
>>
>>global type string6(object s)
>>   object c
>>   if not sequence(s) then
>>      return 0
>>   end if
>>   for i = 1 to length(s) do
>>      c = s[i]
>>      if integer(c) then
>>         if (c < 0) or (c > 255) then
>              ^^^^^
>        Change this to "c <= 0"
>
>>            return 0
>>         end if
>>      else
>>         return 0
>>      end if
>>   end for
>>   return 1
>>end type

>Regards,
>         Daniel  Berstein
>         [daber at pair.com]


I think that it should read (c < 0).  After all, we are not
defining the C language, zero-delimited strings.  We can use all the
characters containable in 1 byte.  Now, if you wish to define a
string type only for printable characters, that is something else,
with even more restrictions.

Larry Gregg

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

Search



Quick Links

User menu

Not signed in.

Misc Menu