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

tools/fast: measure v.c size and parse/check/cgen steps

This commit is contained in:
Alexander Medvednikov
2021-02-07 04:48:54 +01:00
parent 32cd2846f5
commit a81ee0e94e
3 changed files with 41 additions and 1 deletions

View File

@ -1403,9 +1403,20 @@ pub fn (s &string) free() {
s.is_lit = -98761234
}
// before returns the contents before `dot` in the string.
// Example: assert '23:34:45.234'.all_before('.') == '23:34:45'
pub fn (s string) before(dot string) string {
pos := s.index_(dot)
if pos == -1 {
return s
}
return s[..pos]
}
// all_before returns the contents before `dot` in the string.
// Example: assert '23:34:45.234'.all_before('.') == '23:34:45'
pub fn (s string) all_before(dot string) string {
// TODO remove dup method
pos := s.index_(dot)
if pos == -1 {
return s