TopCoder problem "CssPropertyConverter" used in SRM 340 (Division II Level One)



Problem Statement

    

CSS property names are typically all lowercase and written in dash-separated notation, which means that each pair of adjacent words is separated by a single dash. For example, "z-index", "padding-left", and "border-collapse" are typical names. However, if you use JavaScript to set CSS style properties, you need to use camel notation, where each word except the first starts with an uppercase letter, and adjacent words are not separated. All other letters are lowercase. For example, "z-index" would become "zIndex" in camel notation.

You are given a String cssPropertyName containing a property name written in dash-separated notation. Convert cssPropertyName to camel notation and return the result.

 

Definition

    
Class:CssPropertyConverter
Method:getCamelized
Parameters:String
Returns:String
Method signature:String getCamelized(String cssPropertyName)
(be sure your method is public)
    
 

Constraints

-cssPropertyName will contain between 1 and 50 characters, inclusive.
-cssPropertyName will contain only lowercase letters ('a'-'z') and dashes ('-').
-Each dash in cssPropertyName will be surrounded by two letters.
 

Examples

0)
    
"z-index"
Returns: "zIndex"
1)
    
"border-collapse"
Returns: "borderCollapse"
2)
    
"top-border-width"
Returns: "topBorderWidth"

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=7503

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10664&pm=7503

Writer:

Mike Mirzayanov

Testers:

PabloGilberto , brett1479 , Yarin , Olexiy

Problem categories:

String Manipulation