public static String getIndentString(String content, Node node) {
        int offset = node.getBeginOffset();
        int nl = content.lastIndexOf('\n', offset) + 1;
        return content.substring(nl, offset);
    }
StringUtils
For dealing with specific problems related to Strings that represent text documents.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/common/StringUtils.java