Version () { String tagName = myName; if (tagName.startsWith("v.")) { //NON-NLS tagName = tagName.substring(2); } else if (StringUtil.startsWithChar(tagName, 'v')) { tagName = tagName.substring(1); } IntList intComponents=new IntArrayList(); int startInd = 0; while (true) { int ind = tagName.indexOf('.', startInd); if (ind == -1) { break; } String s = tagName.substring(startInd, ind); try { int x = Integer.parseInt(s); intComponents.add(x); startInd = ind + 1; } catch (NumberFormatException e) { break; } } int nonDigitInd = startInd; while (nonDigitInd < tagName.length()) { if (!Character.isDigit(tagName.charAt(nonDigitInd))) { break; } nonDigitInd++; } String digitStr = tagName.substring(startInd, nonDigitInd); if (!digitStr.isEmpty()) { intComponents.add(Integer.parseInt(digitStr)); } String labelWithVersion = tagName.substring(nonDigitInd); int lastNonDigitInd = labelWithVersion.length() - 1; while (lastNonDigitInd >= 0) { if (!Character.isDigit(labelWithVersion.charAt(lastNonDigitInd))) { break; } lastNonDigitInd--; } String labelVersionStr = labelWithVersion.substring(lastNonDigitInd + 1); String label = labelWithVersion.substring(0, lastNonDigitInd + 1); int labelVersion = Integer.MAX_VALUE; if (!labelVersionStr.isEmpty()) { labelVersion = Integer.parseInt(labelVersionStr); } return new Version(intComponents, label, labelVersion); }