String::strip_prefix
Returns this string without the prefix specified. If this string does not start with the prefix, return the string unchanged.
"foo".strip_prefix("f") //-> "oo"
"bar".strip_prefix("f") //-> "bar"
"ffoo".strip_prefix("f") //-> "foo"
Source Codepublic method strip_prefix(this: String, prefix: String): String {
if this.starts_with(prefix) {
// return this.substring(prefix.len(), this.len(), 1)
return this.substring(prefix.len(), this.len())
}
this
}