Skip to main content

strip_loose_version_prefix

Function strip_loose_version_prefix 

Source
pub fn strip_loose_version_prefix(s: &str) -> (&str, &str)
Expand description

Strip a loose leading version prefix: v/V, optionally followed by ., :, -, or _, only when the remainder starts with a digit.

Returns (prefix, rest). When no prefix is recognized, returns ("", s).

§Examples

  • v1.2.3("v", "1.2.3")
  • V1.2.3("V", "1.2.3")
  • v.1.2.3("v.", "1.2.3")
  • v:1.2.3("v:", "1.2.3")
  • v-1.2.3("v-", "1.2.3")
  • v_1.2.3("v_", "1.2.3")
  • 1.2.3("", "1.2.3")