tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Jodd > Strings > String words to Camel case

String words to Camel case 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use StringUtil.wordsToCamelCase() API.

File Name  :  
com/bethecoder/tutorials/jodd/utils/StringWords2CamelTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jodd.utils;

import jodd.util.StringUtil;

public class StringWords2CamelTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    String str = "This is a test message";
    System.out.println(StringUtil.wordsToCamelCase(str));
    System.out.println(StringUtil.wordsToCamelCase(str, ' '));
    
    str = "one:two:three:four";
    System.out.println(StringUtil.wordsToCamelCase(str, ':'));
    
    str = "aaa-bbbb-ccc-ddd-eeeee";
    System.out.println(StringUtil.wordsToCamelCase(str, '-'));
  }

}
   

It gives the following output,
ThisIsATestMessage
ThisIsATestMessage
oneTwoThreeFour
aaaBbbbCccDddEeeee


                    Print

   



Books Recommendation

 
 
bl  br