They say you learn something new every day.

Concats (20/02/2012)

On the subject of string concatenation I realise that I’ve been overlooking an obvious shortcut.

I’ve realised now that the split function is great for turning strings into arrays:

Array = Split(String, WhatToSplitOn)

But there’s also the join function:

String = Join(Array,WhatToPutInBetweenEachElement)

 It may not work everywhere but if you’re doing this:

For Each ThisItem in TheseItems

Element = Elements & “
” & ThisItem


You can easily replace it with:

Element = Join(TheseItems,”

Which is not only faster, but more concise as well. It still needs some work before I can use it everywhere, but with this and the text stream method I should hopefully have put an end to string concatenation in my code.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Tag Cloud

%d bloggers like this: