Welcome to the Joint-Venture Blog from Fabio Cortesi and Stefan Jäger.
I have to admit that I have spend in recent years a lot of my free time into developing with PHP. For me, PHP offers a lot of nice features and it is a easy to write script language. Of course, it’s not Java and it lacks in some features (like type safety, maintainability, and so on).
But in PHP there were two functions, which I used a lot. Implode and Explode. These two functions offered a easy way to split or concatenate strings. Let me make two examples.
explode: splits the string “a;b;c;d” into the array (“a”,”b”,”c”,”d”)
implode: concatenate the elements of the array (“a”,”b”,”c”,”d”) into the string “a;b;c;d”
Of course, the delimiter (the ; in the example) can be chosen individually.
Now, I was searching for such functions in Java. Especially the implode method I missed a lot. But there is a open source framework, which holds the solution. It’s the Lang package of the Apache Commons project (http://commons.apache.org/lang/). Inside this framework, there is the StringUtils class, which offers some interesting string operations.
StringUtils.join(Collection collection, String separator) is the same as implode.
StringUtils.split(String str, String separatorChars) is the same as explode.
Of course, StringUtils offers some other nice features. Just try it out!
If you double click on a tab in Eclipse, the tab get’s opened all over the window. Now, if there is a build process running in the console, the console is always popping up. This is a little bit annoying. But there is a simple trick to solve this situation. Just disable “Show Console When Standard Out Changes” and the console will not pop up again.