Well, $Val = Code vs $Val - Func() saves nothing and actually increases the amount of code, even if just the function, endfunction, and exit statements are considered. I guess what bothered me was that my original code from 4/2009 (original post) returned a unique, short identifier from a text string. The function, which used my code and purported to do the same thing actually takes the simple logic that identifies the connection string and adds a fair amount of code to return an even longer string, which must then be parsed using additional code. While this function might be good to display a message about the connection type, it doesn't provide the simple connection identification that the original code statement did.

I actually could have returned a single char for identification, but 3 chars allowed use of the standards "CON", "RDP", and "ICA" that were easily identified visually and were also simply parsed, as I illustrated above. As you've seen here, using that function resulted in additional confusion due to the verbose messages returned.

As for UDF and documentation, I hear you - my code generally has a 1.3:1 or better comment to code ratio, between many individual comments and the detailed function headers. This, however, was documented in one line in my original response in this thread - the value assigned will have one of three 3-character terms.

Finally, I'm not against a "one line" function, but to be practical, it should be something that's complex or possibly obscure logic so that you don't have to try to reinvent a wheel or research how to get it done each time you need it. This is a simple Left() command of a standard variable - would you convert all such simple statements to functions? I wouldn't.. I also wouldn't approve this in a code review of my team's projects. This would not be called multiple times, does not represent a complex construct, and its use does not clarify the process being performed.

Of course, this is my opinion, and has been for some time on this topic.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D