I had some hidden string formatting in one of my classes, and now that I want to write a test for it, I pulled it out into it's own class. It's your typical "Should I create a StringUtils class?" sort of question.
Should I have
Copy code
class StringUtil {
fun getInitialsFromName(name: String): String {
or just create
Copy code
class InitialGeneratorService {
fun get(name: String): String {
Or should it be a companion or just make a string extension method (seems easily abused though)
I'm definitely overthinking it, but approciate any advice
b
bezrukov
12/12/2021, 9:24 PM
Usually util function in kotlin either a top-level function (remove StringUtil class declaration and move your fun outside) or member of an