I want to convert db columns such as is_deleted
or product_code
which consist of xx_xx
to java-style names: isDeleted
or productCode
. I wonder if there is a way to improve my following code, using regex or such things.
def getJavaName(column):
words = column.split('_')
first = words[0]
return first + ''.join((w.capitalize() for w in words[1:]))