{"id":222,"date":"2015-04-15T15:04:13","date_gmt":"2015-04-15T13:04:13","guid":{"rendered":"http:\/\/blog.thecodecampus.de\/?p=222"},"modified":"2023-12-20T20:13:57","modified_gmt":"2023-12-20T19:13:57","slug":"convert-strings-from-hypen-notation-to-camel-case-java-guava","status":"publish","type":"post","link":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/","title":{"rendered":"Convert Strings from hyphen-notation to camel case (Java \/ Guava)"},"content":{"rendered":"<p>There are many ways how to sperate words in a String for us programmers. One of the most popular are seperation by &#8220;hyphens&#8221; and using the CamelCase Notation. The library\u00a0<a href=\"https:\/\/code.google.com\/p\/guava-libraries\/wiki\/StringsExplained\" target=\"_blank\" rel=\"noopener\">Guava<\/a> from Google provides excellent help for converting a string from one format to the other<\/p>\n<h3>Hyphen Format<\/h3>\n<pre class=\"lang:java decode:true\">String string = \"i-am-a-string\"<\/pre>\n<h3>\u00a0Camel Case Format (<a href=\"http:\/\/en.wikipedia.org\/wiki\/CamelCase\" target=\"_blank\" rel=\"noopener\">Wikipedia<\/a>)<\/h3>\n<pre class=\"lang:java decode:true\">String string = \"iAmAString\"<\/pre>\n<h2>Conversion in Java (using Google Guava)<\/h2>\n<p>The class <strong>CaseFormat<\/strong> provides useful helpers to convert Strings from hyphen format to CamelCase and vice versa.<\/p>\n<pre class=\"lang:java decode:true\">String temp = \"capitalize-me\";\r\nString result = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, temp);\r\nSystem.out.println(result); \/\/produces \"capitalizeMe\"<\/pre>\n<h3>Upcoming<\/h3>\n<p>Next time I will show you how to do the same thing with an AngularJS directive.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many ways how to sperate words in a String for us programmers. One of the most popular are seperation by &#8220;hyphens&#8221; and using the CamelCase Notation. The library\u00a0Guava from Google provides excellent help for converting a string from one format to the other Hyphen Format String string = &#8220;i-am-a-string&#8221; \u00a0Camel Case Format (Wikipedia) [&#8230;]<br \/><a class=\"meta-big\" href=\"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/\"> READ MORE<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[43,42,39],"class_list":["post-222","post","type-post","status-publish","format-standard","hentry","category-java","tag-conversion","tag-guava","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Convert hypen-notation Strings to camelCase in Java \/ Guava<\/title>\n<meta name=\"description\" content=\"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Convert hypen-notation Strings to camelCase in Java \/ Guava\" \/>\n<meta property=\"og:description\" content=\"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development tips and tricks - theCodeCampus Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-15T13:04:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-20T19:13:57+00:00\" \/>\n<meta name=\"author\" content=\"Jan Blankenhorn\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jan Blankenhorn\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/\"},\"author\":{\"name\":\"Jan Blankenhorn\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/623acdcedf59e3d9d86df17721a46188\"},\"headline\":\"Convert Strings from hyphen-notation to camel case (Java \\\/ Guava)\",\"datePublished\":\"2015-04-15T13:04:13+00:00\",\"dateModified\":\"2023-12-20T19:13:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/\"},\"wordCount\":104,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"keywords\":[\"Conversion\",\"Guava\",\"Java\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/\",\"name\":\"Convert hypen-notation Strings to camelCase in Java \\\/ Guava\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\"},\"datePublished\":\"2015-04-15T13:04:13+00:00\",\"dateModified\":\"2023-12-20T19:13:57+00:00\",\"description\":\"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/convert-strings-from-hypen-notation-to-camel-case-java-guava\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Convert Strings from hyphen-notation to camel case (Java \\\/ Guava)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"name\":\"Web Development tips and tricks - theCodeCampus Blog\",\"description\":\"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#organization\",\"name\":\"theCodeCampus\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/TCC-Logo-Bildmarke-quadratisch.jpg\",\"width\":156,\"height\":156,\"caption\":\"theCodeCampus\"},\"image\":{\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/#\\\/schema\\\/person\\\/623acdcedf59e3d9d86df17721a46188\",\"name\":\"Jan Blankenhorn\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/jan-blankenhorn-tcc-author-96x96.webp\",\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/jan-blankenhorn-tcc-author-96x96.webp\",\"contentUrl\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/06\\\/jan-blankenhorn-tcc-author-96x96.webp\",\"caption\":\"Jan Blankenhorn\"},\"description\":\"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.\",\"sameAs\":[\"https:\\\/\\\/thecodecampus.de\\\/ueber-uns\\\/trainer\\\/jan-blankenhorn\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/jan-blankenhorn-w11k\\\/\"],\"url\":\"https:\\\/\\\/www.thecodecampus.de\\\/blog\\\/author\\\/jblankenhorn\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Convert hypen-notation Strings to camelCase in Java \/ Guava","description":"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/","og_locale":"en_US","og_type":"article","og_title":"Convert hypen-notation Strings to camelCase in Java \/ Guava","og_description":"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!","og_url":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/","og_site_name":"Web Development tips and tricks - theCodeCampus Blog","article_published_time":"2015-04-15T13:04:13+00:00","article_modified_time":"2023-12-20T19:13:57+00:00","author":"Jan Blankenhorn","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jan Blankenhorn","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/#article","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/"},"author":{"name":"Jan Blankenhorn","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/623acdcedf59e3d9d86df17721a46188"},"headline":"Convert Strings from hyphen-notation to camel case (Java \/ Guava)","datePublished":"2015-04-15T13:04:13+00:00","dateModified":"2023-12-20T19:13:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/"},"wordCount":104,"commentCount":0,"publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"keywords":["Conversion","Guava","Java"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/","url":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/","name":"Convert hypen-notation Strings to camelCase in Java \/ Guava","isPartOf":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#website"},"datePublished":"2015-04-15T13:04:13+00:00","dateModified":"2023-12-20T19:13:57+00:00","description":"Transform Java strings with Guava. Convert hyphen to camel case effortlessly. Elevate code readability, streamline string operations now!","breadcrumb":{"@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.thecodecampus.de\/blog\/convert-strings-from-hypen-notation-to-camel-case-java-guava\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.thecodecampus.de\/blog\/"},{"@type":"ListItem","position":2,"name":"Convert Strings from hyphen-notation to camel case (Java \/ Guava)"}]},{"@type":"WebSite","@id":"https:\/\/www.thecodecampus.de\/blog\/#website","url":"https:\/\/www.thecodecampus.de\/blog\/","name":"Web Development tips and tricks - theCodeCampus Blog","description":"Tips, tricks, and experiences about developing web and mobile applications with Angular, TypeScript, and Testing.","publisher":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.thecodecampus.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.thecodecampus.de\/blog\/#organization","name":"theCodeCampus","url":"https:\/\/www.thecodecampus.de\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/01\/TCC-Logo-Bildmarke-quadratisch.jpg","width":156,"height":156,"caption":"theCodeCampus"},"image":{"@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.thecodecampus.de\/blog\/#\/schema\/person\/623acdcedf59e3d9d86df17721a46188","name":"Jan Blankenhorn","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/06\/jan-blankenhorn-tcc-author-96x96.webp","url":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/06\/jan-blankenhorn-tcc-author-96x96.webp","contentUrl":"https:\/\/www.thecodecampus.de\/blog\/wp-content\/uploads\/2024\/06\/jan-blankenhorn-tcc-author-96x96.webp","caption":"Jan Blankenhorn"},"description":"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.","sameAs":["https:\/\/thecodecampus.de\/ueber-uns\/trainer\/jan-blankenhorn","https:\/\/www.linkedin.com\/in\/jan-blankenhorn-w11k\/"],"url":"https:\/\/www.thecodecampus.de\/blog\/author\/jblankenhorn\/"}]}},"_links":{"self":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":7,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":2723,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions\/2723"}],"wp:attachment":[{"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thecodecampus.de\/blog\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}