1. Hi i`m new here

    i have a question about "strtrim"

    in the reference there is example: http://wowprogramming.com/docs/api/strtrim

     1) strtrim("121abc456", "615")
     2) -- Returns "21abc4"
    

    after some test, just to be sure

    the "trimChars" = "615"

    are just three separate chars "6" / "1" / "5"

    its working like: find FIRST matching Char in String and trim it, then check another Char from "trimChars"

    Is that true ?!?!?!

    and the second part:

    what if i want to trim not known amount of one char.

    Do i really need to make loop (trim to the point when u dont find any matching char)

    or there is some trick !!!

    regards RedBan

  2. in the reference there is example: http://wowprogramming.com/docs/api/strtrim

     1) strtrim("121abc456", "615")
     2) -- Returns "21abc4"
    

    after some test, just to be sure

    the "trimChars" = "615"

    are just three separate chars "6" / "1" / "5"

    Yes, it's a string containing all of the characters to be trimmed from the start and end of the string. This happens ONCE.

    its working like: find FIRST matching Char in String and trim it, then check another Char from "trimChars"

    Is that true ?!?!?!

    No. It finds any of the characters from the trim set that exist at the beginning of the string and removes them until it stops matching. Then the same is done for the end (conceptually, the implementation may be different).

    and the second part:

    what if i want to trim not known amount of one char.

    Do i really need to make loop (trim to the point when u dont find any matching char)

    or there is some trick !!!

    I don't understand the question. If you want to remove all 'a's from the start and end of a string, you can just call string.trim(str, "a"). If you want to do something other than that, don't use string.trim and instead write a function that does what you want. It's only designed to do one thing.

  3. I believe your second answer, was the answer to the third.

    If you have a string of:

    a dog bit a cat and then jumped away.

    And you str trimmed "a" your string will end up like:

    dog bit c t nd then jumped w y.

    once the trim starts, there is no looping...it will trim any of that character it finds in the string from start to finish.

  4. I do not understand your terminology about 'looping'. You are correct about what strtrim("a") will do. What I don't understand is what you want to do. Can you please give me a concrete example of a string, and what you want to call, and what you want the output to be?