LEFT (return left justified string)

Top  Previous  Next

 

LEFT(string [,length])

LEFT

Left justifies a string.

string

A string constant, variable, or expression.

length

A numeric constant, variable, or expression for the length of the return string. If omitted, length defaults to the length of the string.

 

The LEFT procedure returns a left justified string. Leading spaces are removed from the string. Spaces are padded on the right to return a string of the "length" specied. To remove trailing spaces use CLIP(LEFT())

 

Return Data Type:     STRING

Examples:

LEFT('  ABC') returns 'ABC  '

!******************

CompanyName = LEFT(CompanyName)   !Left justify the company name

!******************

IF FILEDIALOG('Pick file',FileName) THEN

  IF LEFT(FileName,2)='\\' THEN

     STOP('\\UNC paths are not supported!')

  ELSIF UPPER(LEFT(FileName,11))='C:\WINDOWS\' THEN

     STOP('Do not select Windows folder!')

  END

END

!******************

MESSAGE('Sub Total $' & CLIP(LEFT(FORMAT(Inv:PmtTotal,@n-15.2))) & ' plus...')

!******************

IF LEFT(CardNo,1) = '4' THEN

  CardType = 'VISA'

ELSIF LEFT(CardNo,2) >= '50' AND LEFT(CardNo,2) <= '55'

  CardType = 'MC'

ELSIF LEFT(CardNo,4) = '6011'

  CardType = 'DISC'

ELSIF LEFT(CardNo,2) = '34' OR LEFT(CardNo,2) = '37'

  CardType = 'AMEX'

ELSE

  Message('Unknown card type ' & LEFT(CardNo,4))

  RETURN

END

 

See Also:

RIGHT

CENTER

CLIP

SUB