[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strlen & format



Hello,
  I just found a bug in my program caused by thinking that
        (array-dimension (format NIL "1234") 0) = 4.
Strange thing is that the answer is correct if I call string-downcase
on the value that format returns.  I can understand why they behave so.
But are there some related rules on this matter? I checked Cltl I, but could
not find discussions on strlen in the string section.  A quick solution that
I'm using now is to (1) scan the array, (2) coerce it to list then call
length, or (3) write a C function.  Solution (1) doesn't seem safe, since
I cannot be sure that the strings will be padded with some fixed chars.
(2) is O(n), and (3) is not portable.

So, is there a portable O(1) STRLEN?

Thanks.

--Wei Jen Yeh