0

For some code generation I look for a library that can convert any String to a java code convention compliant class name. E.g.

2some_File_name should be converted to SomeFileName

I want to use the converted String in a template engine to generate java classes.

This sounds like a general problem and I wonder if someone knows a library that does that. I wasn't able to find one unfortunately.

Marcus Held
  • 635
  • 4
  • 15
  • 1
    What is stopping you from writing one? – Stultuske Feb 27 '20 at 10:51
  • 1
    Your 'any string' requirement is something special. There a algorithms to convert between kebap case, screaming case, camel case and whatever, but all expect that the input follows some conventions. You probably have to code it yourself... – Andreas Dolk Feb 27 '20 at 11:10
  • What should the class name be for the string `"@#$*"`? And do you want to follow any convention about acronyms based on length, like XMLHttpRequest? – kaya3 Feb 27 '20 at 11:50

1 Answers1

0

Can't you write one on your own?

  1. split the string on every special character
  2. make every first character upper case
  3. concat
nvplus
  • 81
  • 8