April 15, 2015

Convert Strings from hyphen-notation to camel case (Java / Guava)

There are many ways how to sperate words in a String for us programmers. One of the most popular are seperation by “hyphens” and using the CamelCase Notation. The library Guava from Google provides excellent help for converting a string from one format to the other

Hyphen Format

 Camel Case Format (Wikipedia)

Conversion in Java (using Google Guava)

The class CaseFormat provides useful helpers to convert Strings from hyphen format to CamelCase and vice versa.

Upcoming

Next time I will show you how to do the same thing with an AngularJS directive.

 

 

 

theCodeCampus Autor Jan Blankenhorn

Jan Blankenhorn
Developer at thecodecampus </>

Jan works as managing direcotr at w11k. He is excited about server technology as well as modern JavaScript web-apps written mostly in Angular.


Leave a Reply

Add code to your comment in Markdown syntax.
Like this:
`inline example`

```
code block
example
```

Your email address will not be published.