chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] substring function and bounds checks


From: John Cowan
Subject: Re: [Chicken-hackers] substring function and bounds checks
Date: Thu, 7 Feb 2013 20:45:52 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Alex Shinn scripsit:

> Can you provide a real-world example where you'd want to use this
> function?

I used to use it all the time in Perl, where it is the normal behavior
of the substr() function, to pull a fixed-width field out of a line of
text without having to worry about short lines.  If the field was at the
end of the line, the result was short; if the field was not present, the
result was the empty string.  In some contexts, I would then concatenate
spaces to it and truncate the result to the desired width.

-- 
Barry thirteen gules and argent on a canton azure           John Cowan
fifty mullets of five points of the second,             address@hidden
six, five, six, five, six, five, six, five, and six.
        --blazoning the U.S. flag           http://www.ccil.org/~cowan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]