ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

%triml - i didnt know

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • %triml - i didnt know

    This has been around since V5R3 but me being semi-dense
    I never used it.....well today I did so I thought I'd
    share in case anyone else has been on a mental vacation.

    I did a search on the forum and its listed a couple times
    yet I never caught it



    Code:
    *..1....+....2....+....3....+....4....+....5....+....6....+....7...+....
     * LOCATION will have the value 'Toronto, Ontario  '.
     
     /FREE    
         // Trimming blanks 
     
         Location = %triml('  Toronto, Ontario  '); 
         // LOCATION now has the value 'Toronto, Ontario  '. 
     
         // Trimming other characters 
     
         trimmed = %triml('$******5.27***        ' : '$* '); 
                            // trimmed is now '5.27***        '
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  • #2
    Re: %triml - i didnt know

    Yes you can "Trim" any specified character(s). Becuase on the normal trim you don't specify it assumes blanks.

    But specifiing the second paramter you can trim(l/r) any characters.

    See you're never too old to learn....just too old to retain it....
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment


    • #3
      Re: %triml - i didnt know

      FYI, if you can, try to use %triml and %trimr as much as possible instead of the straight %trim. %trim's performance blows.
      "Time passes, but sometimes it beats the <crap> out of you as it goes."

      Comment


      • #4
        Re: %triml - i didnt know

        So use triml and trimr (2 processes) as oppposed to using trim (1 process)? I never concern myself too much such nitty gritty performance issues.
        Bill
        "A good friend will bail you out of jail,
        A true friend would be sitting beside you saying,
        'Wow, that was fun.'"

        Comment


        • #5
          Re: %triml - i didnt know

          I never concern myself too much such nitty gritty performance issues.

          Unless you are going to run a database on an Apple II, then these types of performance issues might be concerning.....
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: %triml - i didnt know

            Yup but I gave up on DB on Apple II just after my DB blew up on my PET.
            Bill
            "A good friend will bail you out of jail,
            A true friend would be sitting beside you saying,
            'Wow, that was fun.'"

            Comment


            • #7
              Re: %triml - i didnt know

              Originally posted by Billw View Post
              So use triml and trimr (2 processes) as oppposed to using trim (1 process)? I never concern myself too much such nitty gritty performance issues.
              Of course that's not what I mean. I mean if you can be fairly confident that the data in a field is already left justified, or if your just concatenating two fields together, just use $trimr, not %trim.
              "Time passes, but sometimes it beats the <crap> out of you as it goes."

              Comment

              Working...
              X