package Ġk ot lite . k apt . mapper Ċ Ċ val Ġcamel Regex Ġ= Ġ"( ?< =[ a - zA - Z ])[ A - Z ] ". to Regex () Ċ val Ġsnake Regex Ġ= Ġ"_ [ a - zA - Z ] ". to Regex () Ċ Ċ // ĠString Ġextensions Ċ fun ĠString . camel To Snake Case (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġreplace ( camel Regex ) Ġ{ ĊĠĠĠĠĠĠĠ Ġ"_ ${ it . value }" ĊĠĠĠ Ġ}. toLowerCase () Ċ } Ċ Ċ fun ĠString . snake ToLower Camel Case (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġreplace ( snake Regex ) Ġ{ ĊĠĠĠĠĠĠĠ Ġit . value . replace ("_ "," ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. toUpperCase () ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun ĠString . snake ToUpper Camel Case (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġthis . snake ToLower Camel Case (). capitalize () Ċ }