| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== RIGHT (return right justified string) ====== | [[resume resume thread execution .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[rollback terminate unsuccessful transaction .htm|{{btn_next_n.gif|Next page}}]] | | || **RIGHT(**//string //[,//length//]**)** {{blk2blue.jpg|blk2blue.jpg}} | **RIGHT** | Right 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, the //length// is set to the length of the //string//. | The **RIGHT** procedure returns a right justified string. Trailing spaces are removed, then the string is right justified and returned with leading spaces. **Return Data Type:     **STRING **Examples:** | **!******************** | | ** ****RIGHT****('ABC  ') returns '  ABC'** | | **!******************** | | **Message = ****RIGHT****(Message)    !Right justify the message** | | **!******************** | | **IF FILEDIALOG('Pick file',FileName)** | | **   CASE UPPER(****RIGHT****(FileName,4))** | | **   OF '.TPS' ; DO TPS_File** | | **   OF '.DBF' ; DO DBase_File** | | **   OF '.CSV' ; DO Text_File** | | **   ELSE** | | **      MESSAGE('Unknown file type ' & ****RIGHT****(FileName,4))** | | **   END** | | **END** | | **!******************** | | **   MESSAGE('Confirm Credit Card Numbers Ends with ' & ****RIGHT****(CardNo,4))** | **See Also:** [[left return left justified string .htm|LEFT]] [[center return centered string .htm|CENTER]] [[sub return substring of string .htm|SUB]]