Is string concatenation in scala as costly as it is in Java?

Scala uses Java strings (java.lang.String), so its string concatenation is the same as Java’s: the same thing is taking place in both. (The runtime is the same, after all.) There is a special StringBuilder class in Scala, that “provides an API compatible with java.lang.StringBuilder“; see http://www.scala-lang.org/api/2.7.5/scala/StringBuilder.html. But in terms of “best practices”, I think most … Read more

Concatenating variables in Bash [duplicate]

Try doing this, there’s no special character to concatenate in bash : mystring=”${arg1}12${arg2}endoffile” explanations If you don’t put brackets, you will ask bash to concatenate $arg112 + $argendoffile (I guess that’s not what you asked) like in the following example : mystring=”$arg112$arg2endoffile” The brackets are delimiters for the variables when needed. When not needed, you … Read more