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

string: make left/right private

This commit is contained in:
Alexander Medvednikov
2019-11-30 12:00:05 +03:00
parent b92a3544f5
commit b38283dcf1
5 changed files with 10 additions and 10 deletions

View File

@ -384,14 +384,14 @@ pub fn (s string) split_into_lines() []string {
}
// 'hello'.left(2) => 'he'
pub fn (s string) left(n int) string {
fn (s string) left(n int) string {
if n >= s.len {
return s
}
return s.substr(0, n)
}
// 'hello'.right(2) => 'llo'
pub fn (s string) right(n int) string {
fn (s string) right(n int) string {
if n >= s.len {
return ''
}