String concatenation

Just playing with Oxygene and tried to concatenate strings and an int (args.length). Guessed it was + and was waiting for an error on doing: “there were " + args.length + " arguments passed in”. But the args.length was automatically converted to a string.

My question is where in the documentation would I have found what the string concatenation operator is? I found “Binary Operator Expressions”, but the concatenation operator is not listed there:

Also, is there a section that would talk about the args.length being automatically converted to a string?

Thanks, logged as bugs://78870

Good question; It seems we don’t have that in docs.

I’ve reported an issue to document this. The way it works is fairly simple, normally we use the operator methods for a type, but string as special; in this case the compiler calls:

Which has overloads for (String, String), (String, Object) and (Object, String)… The end effect is that the value is boxed and ToString is called on it to get the string value. (Same logic applies on our other platforms).


On Island/Windows platform,

How can I Concat array of String?


What is X? I like to concat array of string to one big string

the array, obviously?

to join to a string, you can use x.ToList.JoinedString(joiner). I’ll add JoinedString to sequence as well, so the ToList() can be dropped (been meaning to do that for a while).

What do you want out of it? a string or another array?

With concat you can do something like: myarray.Concat([somestring]).ToARray to get a new string. Else JoinedString can give you a string out of this.

Yes List.JoinedString works

Thank you

1 Like