|
Posted by Paul Lautman on 06/14/06 13:17
Csaba Gabor wrote:
> Rik wrote:
>> Csaba Gabor wrote:
What it seems that you're trying to achieve is similar to REXX's ABBBREV
function. This takes 3 arguments thus:
Abbrev( information, info [, length ] ] )
information -- reference string
The string that may start with the abbreviated text value.
info -- test substring
The abbreviated text value.
length -- minimal substring length
The minimal required length of the test substring -- the default minimum
length is 0 !
Which I would solve like this:
function abbrev($full,$part,$len=0) {
return !(strlen($part)<$len || substr($full,0,strlen($part)) !== $part);
}
Navigation:
[Reply to this message]
|