Extracts the version id from a string

@param versionDir The string
@return Returns the version id of the directory, else -1
346487
private static long getVersionId(String versionDir) {
        try {
            return Long.parseLong(versionDir.replace("version-", ""));
        } catch(NumberFormatException e) {
            logger.trace("Cannot parse version directory to obtain id " + versionDir);
            return -1;
        }
    }
850417
@Override
  public String getVersion(URI uri) throws IOException
  {
    try {
      return StringUtils.format("%d", buildFileObject(uri, config).getLastModified());
    }
    catch (HdfsIOException ex) {
      throw ex.getIOException();
    }
  }
581437
protected function createVersionDirectory($versionDirectory)
    {
        if (! $this->filesystem->isDirectory($versionDirectory)) {
            $this->filesystem->makeDirectory($versionDirectory, 0755, true);

            return true;
        }

        return false;
    }
628244
public static Version parseMavenVersion(String version) {
		if (Strings.isNullOrEmpty(version)) {
			return new Version(0, 0, 0);
		}

		// Detect the snapshot
		final boolean isSnapshot;
		final String coreVersion;
		Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(version);
		if (matcher.matches()) {
			coreVersion = matcher.group(1);
			isSnapshot = true;
		} else {
			matcher = SNAPSHOT_VERSION_PATTERN.matcher(version);
			if (matcher.matches()) {
				coreVersion = matcher.group(1);
				isSnapshot = true;
			} else {
				coreVersion = version;
				isSnapshot = false;
			}
		}

		// Parse the numbers
		final String[] parts = coreVersion.split("[.]"); //$NON-NLS-1$
		final int[] numbers = new int[] {0, 0, 0};
		int i = 0;
		while (i < numbers.length && i < parts.length) {
			try {
				numbers[i] = Integer.parseInt(parts[i]);
				++i;
			} catch (Exception exception) {
				// Force the exit of the loop since a number cannot be find.
				i = numbers.length;
			}
		}
		// Reply
		if (isSnapshot) {
			return new Version(numbers[0], numbers[1], numbers[2], SNAPSHOT_QUALIFIER);
		}
		return new Version(numbers[0], numbers[1], numbers[2]);
	}
479729
def get_version(self, version_id=None):
        
        return ObjectVersion.get(bucket=self.obj.bucket, key=self.obj.key,
                                 version_id=version_id)
762481
protected String getVersionFromServer() throws IOException {
		URL url = new URL(VERSION_CHECK_URL);
		InputStream is = url.openStream();
		try {
			byte[] buff = new byte[4048];
			int len = is.read(buff);
			return new String(buff, 0, len);
		} finally {
			is.close();
		}
	}
783201
protected String getVersionString(int sessionVersion) {
        String sessionVersionString = _versionPrefix;
        if (_versionPrefixLength > 0) {
            if (sessionVersion > 0) {
                StringBuffer sb = new StringBuffer();
                sb.append(_versionPrefix).append(sessionVersion);
                sessionVersionString = sb.substring(sb.length() - _versionPrefixLength, sb.length());
            }
        } else {
            sessionVersionString = "";
        }
        return sessionVersionString;
    }
774004
public static Version parseVersion(String version) {
		if (!Strings.isNullOrEmpty(version)) {
			try {
				return Version.parseVersion(version);
			} catch (Throwable exception) {
				//
			}
		}
		return null;
	}
1042200
def extract_version_from_filename(filename):
    """"""
    filename = os.path.splitext(os.path.basename(filename))[0]
    if filename.endswith('.tar'):
        filename = os.path.splitext(filename)[0]
    return filename.partition('-')[2]
784632
private int parseVersion( String uri ) {
    if( uri.length() <= 1 || uri.charAt(0) != '/' ) // If not a leading slash, then I am confused
      return (0<<16)|LATEST_VERSION;
    if( uri.startsWith("/latest") )
      return (("/latest".length())<<16)|LATEST_VERSION;
    int idx=1;                  // Skip the leading slash
    int version=0;
    char c = uri.charAt(idx);   // Allow both /### and /v###
    if( c=='v' ) c = uri.charAt(++idx);
    while( idx < uri.length() && '0' <= c && c <= '9' ) {
      version = version*10+(c-'0');
      c = uri.charAt(++idx);
    }
    if( idx > 10 || version > LATEST_VERSION || version < 1 || uri.charAt(idx) != '/' )
      return (0<<16)|LATEST_VERSION; // Failed number parse or baloney version
    // Happy happy version
    return (idx<<16)|version;
  }
1054522
private String getVersion(final ClassLoader classLoader, final String className, final String methodName) {
    log.trace("Getting version; class-loader: {}, class-name: {}, method-name: {}",
        classLoader, className, methodName);

    try {
      Class<?> type = classLoader.loadClass(className);
      Method method = type.getMethod(methodName);
      Object result = method.invoke(null);
      if (result != null) {
        return result.toString();
      }
    }
    catch (Throwable e) {
      log.trace("Unable determine version from: {}", className);
    }

    return null;
  }
281359
protected function createVersionIndex($versionDirectory)
    {
        $indexPath = $versionDirectory.'/index.md';

        if (! $this->filesystem->exists($indexPath)) {
            $content = $this->generateIndexContent($this->getStub('index'));
            $this->filesystem->put($indexPath, $content);

            return true;
        }

        return false;
    }
428085
function convertVersionNumber (ver) {
    var hashVersion = {
        '18.0': '1.0.1',
        '18.1': '1.1',
        '26.0': '1.2',
        '28.0': '1.3',
        '30.0': '1.4',
        '32.0': '2.0'
    };
    var rver = ver;
    var sStr = ver.substring(0, 4);
    if (hashVersion[sStr]) {
        rver = hashVersion[sStr];
    }
    return (rver);

}
410418
public static Object[] parseVersionString(String versionString) {
        if (versionString == null) {
            return null;
        }

        // check for whitespace
        if (versionString.matches("\\s")) {
            return null;
        }

        // split on the dots
        String[] split = versionString.split("\\.");
        if (split.length == 0) {
            return null;
        }

        Object[] v = new Object[split.length];
        int i = 0;
        for (String s : split) {
            try {
                v[i] = Integer.parseInt(s);
            } catch (NumberFormatException e) {
                v[i] = s;
            }
            i++;
        }

        // check for a numeric beginning
        if (v[0] instanceof Integer) {
            return v;
        }
        else {
            return null;
        }
    }
139381
@Restricted(NoExternalUse.class)
    public Iterator<VersionNumber> getVersionList() {
        TreeSet<VersionNumber> set = new TreeSet<VersionNumber>();
        for (VersionRange vr : data.values()) {
            if (vr.max != null) {
                set.add(vr.max);
            }
        }
        return set.iterator();
    }
1338451
static int getMajorJavaVersion(String javaVersion) {
    int version = parseDotted(javaVersion);
    if (version == -1) {
      version = extractBeginningInt(javaVersion);
    }
    if (version == -1) {
      return 6;  // Choose minimum supported JDK version as default
    }
    return version;
  }
37317
public static int getVersion(String version) {

        int ver = Integer.parseInt(version);
        return Math.abs(ver);
    }