Convert between different string notations commonly found in programming. Useful, for example, to build identifiers when generating code. Also includes notations to build valid Java type or member names.
We support the following notations:
- General Programming
- LowerCamelCase, e.g.
thisIsMyString - UpperCamelCase, e.g.
ThisIsMyString - SnakeCase, e.g.
this_is_MY_String - ScreamingSnakeCase, e.g.
THIS_IS_MY_STRING
- LowerCamelCase, e.g.
- Java
- JavaMemberName, e.g.
thisIsMyString - JavaTypeName, e.g.
ThisIsMyString - JavaConstantName, e.g.
THIS_IS_MY_STRING - JavaPackageName, e.g.
this.is.MY.String - JavaPackagePart, e.g.
thisismystring
- JavaMemberName, e.g.
- File System
- UnixPath, e.g.
/home/user/some/file - WindowsPath, e.g.
C:/Users/user/some/file
- UnixPath, e.g.
- Miscellaneous
- NormalWords, e.g.
this is MY String
- NormalWords, e.g.
string-notation converts Strings from their notation into a Word, which is a notation-agnostic representation.
Words can then be transformed into Strings in a notation again.
importde.joshuagleitze.stringnotation.LowerCamelCaseimportde.joshuagleitze.stringnotation.ScreamingSnakeCaseimportde.joshuagleitze.stringnotation.fromNotation// myVariable -> MY_VARIABLE"myVariable".fromNotation(LowerCamelCase).toNotation(ScreamingSnakeCase)importde.joshuagleitze.stringnotation.JavaTypeNameimportde.joshuagleitze.stringnotation.NormalWordsimportde.joshuagleitze.stringnotation.fromNotation// 1 Type Name 4 You! -> TypeName4You"1 Type Name 4 You!".fromNotation(NormalWords).toNotation(JavaTypeName)importde.joshuagleitze.stringnotation.LowerCamelCase;
importde.joshuagleitze.stringnotation.UpperCamelCase;
importstaticde.joshuagleitze.stringnotation.StringToWord.fromNotation;
// myVariable -> MY_VARIABLEfromNotation("myVariable", UpperCamelCase.INSTANCE).toNotation(LowerCamelCase.INSTANCE);importde.joshuagleitze.stringnotation.JavaTypeName;
importde.joshuagleitze.stringnotation.NormalWords;
importstaticde.joshuagleitze.stringnotation.StringToWord.fromNotation;
// 1 Type Name 4 You! -> TypeName4YoufromNotation("1 Type Name 4 You!", NormalWords.INSTANCE).toNotation(JavaTypeName.INSTANCE);All contributions (no matter if small) are always welcome.