REM ***********************************************
REM Title: String Length Cap
REM Author: Phaelax
REM Downloaded from: http://dbcc.zimnox.com/
REM ***********************************************
 
REM **************************************************
REM Returns the string truncated to a specified width
REM in pixels.
REM **************************************************
function CapLength$(string$, width)
   L = len(string$)
   min = width / text width("A")
   for j = min to L
      if text width(left$(string$,j)) > width then exitfunction left$(string$,j-1)
   next j
endfunction string$