perjantai 15. marraskuuta 2013

Concatenate Strings vs Format Into String

Why you should use Format Into String function instead of Concatenate Strings function? Here are couple of examples why.

This is a very common use case of Concatenate Strings function:

And this is how you should do it with Format into String:

It will produce the same result. Much cleaner and faster code. Just imagine if there were 10 or more inputs.

Here is another nice thing that you can do with Format into String function. Example: You need to create a function that will change binary numbers to string that has 8 digits like here:
1011 -> 00001011
10111 -> 00010111
101 -> 00000101

Yeah it's quite easy job for any programmer. But did you know that you can use Format into String function too?

Yeah it was that easy :) And it can do so much more. You should always try to avoid Concatenate Strings function and use Format into String function instead. It's a very good function when you learn to use it. It will produce much cleaner code and it's very efficient too.

Ei kommentteja:

Lähetä kommentti