| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== LEFT (return left justified string) ====== | [[lastfield return last window control .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[len return length of string .htm|{{btn_next_n.gif|Next page}}]] | | || **LEFT(**//string// [,//length//]**)** {{blk2blue.jpg|blk2blue.jpg}} | **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 return right justified string .htm|RIGHT]] [[center return centered string .htm|CENTER]] [[clip return string without trailing spaces .htm|CLIP]] [[sub return substring of string .htm|SUB]]