Chas, Thank you for your remind. It is helpful.
Best, Jialin On Wed, Apr 9, 2008 at 3:51 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > On Wed, Apr 9, 2008 at 4:31 PM, Jialin Li <[EMAIL PROTECTED]> wrote: > > substr($string,0,2) will give you the first two digits > > substr($string,5,1) will give you the sixth digit. > snip > > There are at least three downsides to using the substr function: > 1. multiple function calls > 2. lots of typing > 3. no guarantee that the input string is in the right format > > The substr function is useful, but regexes and the unpack function are > much better for most cases. One case where the substr function is > better than a regex is the extraction of a substring from the end of a > string which may have a variable length (i.e. fixed length regexes > that are anchored only at the end of the string). > > -- > Chas. Owens > wonkden.net > The most important skill a programmer can have is the ability to read. > -- Jialin Li 832-618-3598