>By using SPACE$(255), the code is much more readable, but speed is down >by 2% :-) > >But thanks to your suggestion, I have modified the SPACE$ statement to >fill only the required number of bytes and the function now averages >a 2x speed increase! > >Here is the final version of PADLEFT$... > C'mon, I want my version, too. :-) This returns the source string unchanged if totalLength is too small, and returns a 255-byte string if it's too big. Is this faster, or slower? 0"0 =J= a y " local mode local fn PADLEFT$ (@srcStr as ptr, totalLength as long) dim padStr as str255 padStr[0] = 0 if totalLength > 255 then totalLength = 255 if totalLength > srcStr.0`` then padStr = space$(totalLength - srcStr.0``) padStr += srcStr.0$ end fn = padStr dim r for r = 10 to 50 print fn PADLEFT$ ("This is a test", r) next