Get a version implementation. Return the best match for the provided string.

@param vstring A string version to be parsed
@return A version implementation
487677
public IVersion getVersion(String vstring) throws InvalidRangeException
  {
    IVersionRange range = getRange(vstring);
    if (range == null) {
      return null;
    }
    return range.getMinimum();
  }
429625
protected String getVersion() {

    Manifest manifest = ManifestLoader.loadManifest(getClass());
    String versionNumber = null;
    if (manifest != null) {
      versionNumber = ManifestLoader.getValue(manifest, Attributes.Name.IMPLEMENTATION_VERSION);
      if (versionNumber == null) {
        versionNumber = ManifestLoader.getValue(manifest, Attributes.Name.SPECIFICATION_VERSION);
      }
    }
    if (versionNumber == null) {
      versionNumber = SNAPSHOT;
    }
    return versionNumber;
  }
436495
def extractVersion(string, default='?'):
    
    return extract(VERSION_PATTERN, string, condense=True, default=default,
                   one=True)
58797
public String getVersion() {
        String version = getMavenModel().getVersion();
        if ( version == null && getMavenModel().getParent() != null ) {
            version = getMavenModel().getParent().getVersion();
        }

        return version;
    }
661787
private static String parseEngineVersion(Engine engine, String userAgentString) {
		final String regexp = engine.getName() + "[\\/\\- ]([\\d\\w\\.\\-]+)";
		final Pattern pattern = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
		return ReUtil.getGroup1(pattern, userAgentString);
	}
291577
func VersionString() string {
	version := ""
	version += fmt.Sprintf("Version:        %s\n", VERSION)
	version += fmt.Sprintf("Git hash:       %s\n", REVISION)
	version += fmt.Sprintf("Built:          %s\n", BUILTAT)
	version += fmt.Sprintf("Golang version: %s\n", runtime.Version())
	version += fmt.Sprintf("OS/Arch:        %s/%s\n", runtime.GOOS, runtime.GOARCH)
	return version
}
772453
public java.lang.String getVersion() {
    java.lang.Object ref = version_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        version_ = s;
      }
      return s;
    }
  }
357895
def _version_string():
    
    platform_system = platform.system()
    if platform_system == 'Linux':
        os_name, os_version, _ = platform.dist()
    else:
        os_name = platform_system
        os_version = platform.version()
    python_version = platform.python_version()
    return 'trytravis %s (%s %s, python %s)' % (__version__,
                                                os_name.lower(),
                                                os_version,
                                                python_version)
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;
        }
    }
1053179
func (v *Version) VersionString() string {
	return fmt.Sprintf("%d.%d.%d%s", v.Major, v.Minor, v.Micro, v.Additional)
}
954255
public static int compareVersions(String v1, String v2) {
		String[] v1a = v1.split("\\.");
		String[] v2a = v2.split("\\.");
		Integer v1M = Integer.parseInt(v1a[0]);
		Integer v2M = Integer.parseInt(v2a[0]);
		if (v1M < v2M) {
			return -1;
		} else if (v1M > v2M) {
			return 1;
		} else {
			Integer v1min = Integer.parseInt(v1a[1]);
			Integer v2min = Integer.parseInt(v2a[1]);
			if (v1min < v2min) {
				return -1;
			} else if (v1min > v2min) {
				return 1;
			} else {
				return 0;
			}
		}
	}
188916
public static function fromString(string $versionString) : Version
    {
        if (!preg_match(
            '#^'
            . '(v|release\-)?'
            . '(?P<core>(?:[0-9]|[1-9][0-9]+)(?:\.(?:[0-9]|[1-9][0-9]+)){2})'
            . '(?:\-(?P<preRelease>[0-9A-Za-z\-\.]+))?'
            . '(?:\+(?P<build>[0-9A-Za-z\-\.]+))?'
            . '$#',
            $versionString,
            $parts
        )) {
            throw InvalidVersionStringException::forVersionString($versionString);
        }

        [$major, $minor, $patch] = explode('.', $parts['core']);
        $preRelease = !empty($parts['preRelease']) ? PreRelease::fromIdentifiersString($parts['preRelease']) : new NoPreRelease();
        $build = !empty($parts['build']) ? Build::fromIdentifiersString($parts['build']) : new NoBuild();

        return static::fromParts((int) $major, (int) $minor, (int) $patch, $preRelease, $build);
    }
394160
public String getVersion() {
        final Object version = getHeader(HttpMessageHeaders.HTTP_VERSION);

        if (version != null) {
            return version.toString();
        }

        return null;
    }
159144
private function getAliasVersion($versionString){
        if(preg_match('/^[0-9]+\.[0-9]+\.\*$/', $versionString)){
            //already an alias version string
            return $versionString;
        }else{
            $version = SemVerParser::parse($versionString);
            return $version->getMajor().'.'.$version->getMinor().'.*';
        }
    }
998921
public org.tensorflow.framework.VersionDef getVersion() {
    return version_ == null ? org.tensorflow.framework.VersionDef.getDefaultInstance() : version_;
  }
904514
public function getVersionString() {
        if (!isset($this->versionString)) {
            if (!$this->isConnected())
                $this->connect();
            $this->versionString = $this->sqlite->version()['versionString'];
        }
        return $this->versionString;
    }
644775
private String getPackageVersion(String packageInfoString) {
        // packageInfoString for example - audit-libs-2.7.6-3.el7-x86_64
        try {
            String firstDotString = packageInfoString.substring(0, packageInfoString.indexOf(Constants.DOT));
            int lastIndexOfHyphen = firstDotString.lastIndexOf(Constants.DASH);
            int lastIndexOfDot = packageInfoString.lastIndexOf(Constants.DOT);
            String packVersion = packageInfoString.substring(lastIndexOfHyphen + 1, lastIndexOfDot);
            if (StringUtils.isNotBlank(packVersion)) {
                return packVersion;
            }
        } catch (Exception e) {
            logger.warn("Failed to create package version : {}", e.getMessage());
        }
        return null;
    }