Re: Right justify
Posted in 1999
In article <7f7hm9$l83$1@news.monmouth.com>, Bill Zega <billz@netlabs.net> wrote: >Are there any right_justify functions out there? I need a function that >receives a character parameter (char(100) max), and returns the parameter >right justified. My main problem is that I cannot figure out how to size a >char variable INCLUDING trailing spaces. Example: > >char_var char(10) >let char_var="abc " ># Note: length(char_var)=3, not 10 >let char_var=right_justify(char_var) >char_var should now be " abc" (7 spaces, "abc") > >Thanks! Like this, maybe? function rightshift(a_string) define a_string, ret_val char(10) define i smallint let i = length(a_string) let ret_val = (10-i) spaces, a_string clipped return ret_val end function { rightshift }