Jump to content
Sign in to follow this  

About StringTrim

Recommended Posts


:whistle: I came in here for the first time just to take alook around. I actually thought of something to say, but discovered that the topic has been locked. It was actually about the string trim thing, which I like and use. I think one of the great things about functions like this is that it allows beginners to see in detail how scripting concepts and ideas can be developed. More elegant solutions may be available, but they may be less accessable to a less advanced script writer.

One method that I have used in string manipulation relys heavily on the stringtrim function. Perhaps it is primative and someone might have a more elegant solution that they wish to share with me. It goes like this:

Start with the string '1'

Add some zeros (1x10^x)

set x = 2

String '100' represents an infinite number of values. For example: the string represents 4 in binary.

Reverse the string '001'

Now the value is 1 again. Perhaps we can get rid of the zeros on the right, but then again the string length might be important (I might want to reverse it again).

<!-- Somehow I feel like I'm preaching to the converted, so please don't anyone take offence -->

Now suppose I set the string length to mulitiple sets of 4 binary characters (hex values 1 through F), and I set my focus on the position of the characters rather than the value.

The string '1' represents the 4th position in the string 0001

The string '0010' represents the third position, '0100' the second position and '1000' the first position.

All these strings may also represent three false returns and one positive return, regardless of position.

In modular systems the zeros can sometimes be removed from either end of a string without compromising the data.

For example take the string '10001000'.

Suppose the only information that is important to me is the fact that there are two '1's separated by three zeros '10001'.

Now I can happily chop off the zeros to the right of the string.

The same information can be represented by four different hexadecimal numbers:

Hex 11, 22, 44 and 88. (bin 00010001, 00100010, 01000100 and 10001000)

So please leave the stringtrim thing alone, it's doing a good job.

Share this post

Link to post
Share on other sites

It think the other topic was locked with the conclusion that StringTrim() serves a purpose and nothing is going to happen to it when my memory serves me correct ... :whistle:

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
Live for the present,
Dream of the future,
Learn from the past.

Share this post

Link to post
Share on other sites

Thanks for putting my mind at ease. I have not been a regular on the AutoIt forums but everytime I come here with a problem I get good feedback. There's so much stuff here to learn about. One person who has helped me a lot is Mandaar. I just thought it would make a change for me to get away from the 'Help and Support Forum' where I normally hang out and try out this one for a change. I do have one or two questions I would like to ask the AutoIt developers, but I need to first search the forum to see if the topics have already been covered. Until then I'm off back to Hekp and Support. Later.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this