Re: Right justify
Posted in 1999
From: "Bill Zega" <billz@netlabs.net> > >I was hoping to perform this function without passing the length. I guess >what I really need is pointers so I can pass the address of the variable, >not the contents of the variable. I am new to Informix 4gl but it looks >like there is no access to pointers, true? True. Perhaps you could be a little more specific in what you want? For example, if you are working on something out of the database, you can pass the table name and column name and the function can go and work out the maximum length of the column for you. You can't really do this if you're working on a program-only variable, though. >Jonathan Leffler wrote in message >>In that case, you have to tell the function how wide the output >>should be: >> >>LET g_50 = rightshift("123456 ", 50) >> >>function rs(str, len) >> define str char(100), len integer >> define i integer >> define ret char(100) >> let i = length(str) >> let ret = (len - i) spaces, str clipped >> return ret >>end function >> >>Untested - nowhere near a compiler. The version I use is rjust() >>and is written in C. You should check for invalid lengths of both >>the string and the field width, and (probably) null strings. >> >>-- >>Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) >>Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN >>#include <disclaimer.h> >> > > ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com