WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Operators

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Binary String Concatenation Operator

 Keywords: Colon Operator String Concatenation COm OLE DllCall DllCdecl StrCat 

Question:

The colon ':' is the 'Binary string concatenation' operator. Correct? It appears to do the same thing as StrCat(). Will the ":" operator work as a shorthand replacement for StrCat() in all situations or does it have it's limitations. When can you use it and when can't you with strings?

Answer:

Yes, the colon character is a binary string operators used for concatenation.

The only time you must be careful using this operator is when calling a OLE/COM method, where the colon operator is also used for named parameters.

Note the Colon operator is also used as a type specifier in COM/OLE and DllCall/DllCdecl calls. If you want to use the concatenation operator in a COM method parameter, you need to specify the parameters type first so that the parser will interpret the rest of the colons as the concatenation operator. The colon operator is used as the type specifier for object method and property parameters in the same way it is used as a type specifier for DllCall/DllCallCdecl. The difference between the two usages involves the types specified. When WinBatch encounters a single colon as part of a object method or property parameter, it always interprets the first colon found as a type specifier as in 'typespecificaton:value'. Subsequent colons are interpreted as concatenation. So in order to use the concatenation operator in an object method or property parameter, you need to always have a type specifier first. Since a type specifier with out a type specification is a valid sub expression - it tells WinBatch to take its best guess - you simple need to prepend the colon to the beginning of the parameter to use concatenation in an object method or property parameter

object.method(:part_value1a:part_value1b, value2, :part_value3a:part_value3b)

Article ID:   W18217
Filename:   Binary String Concatenation Operator .txt
File Created: 2009:06:04:09:31:58
Last Updated: 2009:06:04:09:31:58