Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
In article <3i5ni5$i3t@hammer.msfc.nasa.gov> mallozzi@ssl.msfc.nasa.gov writes: > > Dear RSI, > Is it possible to improve STRTRIM so that I can do > STRTRIM(x, F='(f5.2)', 2) > instead of > STRTRIM(STRING(x, F='(f5.2)'), 2) > I often use the latter construction in widget programming so that > displayed values have a nice format. Hear, hear! I find myself doing this all the time. This does, however, turn STRTRIM into something other than a "string trimmer". Perhaps it might be more appropriate to add the leading/trailing blank elimination function to STRING instead. -- Joseph M. Zawodny (KO4LW) NASA Langley Research Center Internet: j.m.zawodny@larc.nasa.gov MS-475, Hampton VA, 23681-0001 TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa.na
In article <3icn4p$6hi@reznor.larc.nasa.gov>, zawodny@arbd0.larc.nasa.gov (Joseph M Zawodny) writes: |> In article <3i5ni5$i3t@hammer.msfc.nasa.gov> mallozzi@ssl.msfc.nasa.gov writes: |> >Is it possible to improve STRTRIM so that I can do |> > STRTRIM(x, F='(f5.2)', 2) |> >instead of |> > STRTRIM(STRING(x, F='(f5.2)'), 2) |> >I often use the latter construction in widget programming so that |> >displayed values have a nice format. |> |> Hear, hear! I find myself doing this all the time. This does, however, turn |> STRTRIM into something other than a "string trimmer". Perhaps it might be more |> appropriate to add the leading/trailing blank elimination function to STRING |> instead. Joseph is right....what is needed is for STRING() to allow a floating format descriptor like F0.2 that works like I0...creates a string of just enough characters to contain the float of appropriate precision, akin to using "%.2f" in sprintf() in C. I was disappointed to find that F0 was not allowed...I use I0 all the time. As far as tightening up your code, you could define a function to do the combined operation. And wouldn't STRTRIM( ,1) suffice, since STRING() is just inserting leading, not trailing blanks? -- Dr. Marty Ryba | Generation X: MIT Lincoln Laboratory | Too young to be cynical, ryba@ll.mit.edu | too old to be optimistic. Of course nothing I say here is official policy, and Laboratory affiliation is for identification purposes only, blah, blah, blah....