parse

fun parse(constraintString: String): Constraint(source)

Parses the constraintString as a Constraint and returns the result or throws a ConstraintFormatException if the string is not a valid representation of a constraint.

Samples

import io.github.z4kn4fein.semver.constraints.Constraint
import io.github.z4kn4fein.semver.constraints.ConstraintSerializer
import io.github.z4kn4fein.semver.constraints.satisfiedBy
import io.github.z4kn4fein.semver.constraints.satisfiedByAll
import io.github.z4kn4fein.semver.constraints.satisfiedByAny
import io.github.z4kn4fein.semver.constraints.toConstraint
import io.github.z4kn4fein.semver.constraints.toConstraintOrNull
import io.github.z4kn4fein.semver.toVersion
import kotlinx.serialization.json.Json

fun main() { 
   //sampleStart 
   print(Constraint.parse(">=1.0.0 || <5.x")) 
   //sampleEnd
}