mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: c2v fixes
This commit is contained in:
@ -841,9 +841,10 @@ pub fn (s string) capitalize() string {
|
||||
if s.len == 0 {
|
||||
return ''
|
||||
}
|
||||
sl := s.to_lower()
|
||||
cap := sl[0].str().to_upper() + sl.right(1)
|
||||
return cap
|
||||
return s[0].str().to_upper() + s[1..]
|
||||
//sl := s.to_lower()
|
||||
//cap := sl[0].str().to_upper() + sl.right(1)
|
||||
//return cap
|
||||
}
|
||||
|
||||
pub fn (s string) is_capital() bool {
|
||||
|
@ -575,10 +575,11 @@ fn test_capitalize() {
|
||||
assert s.capitalize() == ''
|
||||
s = 'TEST IT'
|
||||
assert !s.is_capital()
|
||||
assert s.capitalize() == 'Test it'
|
||||
assert s.capitalize() == 'TEST IT'
|
||||
s = 'Test it'
|
||||
assert s.is_capital()
|
||||
assert s.capitalize() == 'Test it'
|
||||
assert 'GameMission_t'.capitalize() == 'GameMission_t'
|
||||
}
|
||||
|
||||
fn test_title() {
|
||||
|
Reference in New Issue
Block a user