Version (String text) { if (text == null || text.isBlank()) { return Version.UNKNOWN; } Iterator<String> iterator = text.lines().iterator(); while (iterator.hasNext()) { String line = iterator.next(); int startComment = line.indexOf(VERSION_COMMENT_START); if (startComment >= 0) { int endComment = line.indexOf(VERSION_COMMENT_END); if (endComment > startComment) { return Version.fromString(line.substring(startComment + VERSION_COMMENT_START.length(), endComment).trim()); } } } return Version.UNKNOWN; }