1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin,ast: apply small performance improvements, suggested by hotspot

This commit is contained in:
Delyan Angelov
2021-11-07 13:30:40 +02:00
parent d8f971ffb5
commit 80242c8041
8 changed files with 74 additions and 16 deletions

View File

@ -686,6 +686,14 @@ fn test_starts_with() {
assert s.starts_with('Language') == false
}
fn test_starts_with_capital() {
assert 'A sentence'.starts_with_capital()
assert 'A paragraph. It also does.'.starts_with_capital()
assert ''.starts_with_capital() == false
assert 'no'.starts_with_capital() == false
assert ' No'.starts_with_capital() == false
}
fn test_trim_prefix() {
s := 'V Programming Language'
assert s.trim_prefix('V ') == 'Programming Language'