Avatar ·

How to translate static methods from Java to Kotlin? (static equivalent)

Hello everyone! I'm switching from Java to Kotlin and ran into a problem. In Java, I often use static methods for utility classes, for example, for working with dates or string validation. Here's typical Java code: ```java public class StringUtils { public static boolean isEmpty(String str) { return str == null || str.trim().isEmpty(); } public static String capitalize(String str) { if (str == null || str.isEmpty()) return str; return str.substring(0, 1).toUpperCase() + str.substring(1); } } // Usage: if (StringUtils.isEmpty(userInput)) { System.out.println("Input is empty"); } ``` I'm trying to port this to Kotlin, but the `static` keyword doesn't exist in Kotlin. I tried just writing `companion object`, but it looks