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 Blankenhorn brings over 15 years of experience as a developer and trainer, specializing in web development with Angular. He enjoys engaging with people and shares practical examples in his training sessions with a touch of humor.


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.