Search code examples
javainstallationapache-commonsconfigurelang

Trying To Capatalize Each Word In A String In Java


I'm trying to capitalize the first character of each word in a string in Java. Yes I've done my research, I found this How to capitalize the first character of each word in a string. I've downloaded the binaries but I have no clue how to install them. So how do I install Lang https://commons.apache.org/proper/commons-lang/. Thank you, SQL :P

EDIT: I'm using Eclipse. I wish to use the method capitalizeFully() that is in WordUtils. How would I do this?


Solution

  • Download latest version of Apache Commons Lang commons-lang3-version-bin.zip

    Currenly commons-lang3-3.1-bin.zip

    Place the jar file commons-lang3-version.jar in your class path and

    import org.apache.commons.lang.WordUtils;
    

    in your class

    Finally use

    WordUtils.capitalize(str) or WordUtils.capitalizeFully(str)