mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Make starts_with_ignore_ascii_case not lie if the strings are the same length.
This commit is contained in:
parent
d8a22d8bd7
commit
9e00efc8a5
2 changed files with 7 additions and 1 deletions
|
@ -148,6 +148,6 @@ pub fn str_join<I, T>(strs: I, join: &str) -> String
|
|||
|
||||
/// Returns true if a given string has a given prefix with case-insensitive match.
|
||||
pub fn starts_with_ignore_ascii_case(string: &str, prefix: &str) -> bool {
|
||||
string.len() > prefix.len() &&
|
||||
string.len() >= prefix.len() &&
|
||||
string.as_bytes()[0..prefix.len()].eq_ignore_ascii_case(prefix.as_bytes())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue