How do I convert CamelCase into human-readable names in Java?
Posted
by Frederik
on Stack Overflow
See other posts from Stack Overflow
or by Frederik
Published on 2010-04-01T10:42:06Z
Indexed on
2010/04/01
10:43 UTC
Read the original article
Hit count: 346
I'd like to write a method that converts CamelCase into a human-readable name.
Here's the test case:
public void testSplitCamelCase() {
assertEquals("lowercase", splitCamelCase("lowercase"));
assertEquals("Class", splitCamelCase("Class"));
assertEquals("My Class", splitCamelCase("MyClass"));
assertEquals("HTML", splitCamelCase("HTML"));
assertEquals("PDF Loader", splitCamelCase("PDFLoader"));
assertEquals("A String", splitCamelCase("AString"));
assertEquals("Simple XML Parser", splitCamelCase("SimpleXMLParser"));
assertEquals("GL 11 Version", splitCamelCase("GL11Version"));
}
© Stack Overflow or respective owner