In PHP we have a function called Trim() to remove characters from a string. However there are no the equivalent to PHP’s trim in Flash. But most time we need to trim a string with extra white space, so we can do only write this by ourselves. The following is 7 actionscript function which can do the same. They might help someone else. *If you know more please don’t hesitate to leave a comment.
Posts Tagged ‘trim’
No matter what kind language using programmer will always accumulate many useful and daily using function with rich in development experience day by day. And then the accumulation become to a library at last. Of course it’s include the flex programmers. Following is some very basic, very simple functions which I’ve collected. How about you? If have any proudly and recommendable functions? Then, don’t only stock in your head, leave your comments. Let’s share.
Some times we need to trim a string from white space at the front and end,even all in the string.How can we do that elegantly?Add the following string prototype function to your code. You will call it like predefined String member functions like Substring(),charAt() and indexOf().
The code below shows the function declaration and how to use it.