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

make trim use cutset like trim_right/trim_left

This commit is contained in:
joe-conigliaro
2019-08-27 14:53:56 +10:00
committed by Alexander Medvednikov
parent 3db50f724b
commit 02fc7e14cd
5 changed files with 37 additions and 23 deletions

View File

@ -325,8 +325,8 @@ pub fn (v mut V) cc_msvc() {
}
}
arg := if lowest != -1 {
rest = base.right(lowest).trim_space().trim(`,`)
base.left(lowest).trim_space().trim(`,`)
rest = base.right(lowest).trim_space().trim(',')
base.left(lowest).trim_space().trim(',')
} else {
rest = ''
base.trim_space()

View File

@ -9,12 +9,12 @@ import strings
fn sql_params2params_gen(sql_params []string, sql_types []string, qprefix string) string {
mut params_gen := ''
for i, mparam in sql_params {
param := mparam.trim(` `)
param := mparam.trim_space()
paramtype := sql_types[ i ]
if param[0].is_digit() {
params_gen += '${qprefix}params[$i] = int_str($param).str;\n'
}else if param[0] == `\'` {
sparam := param.trim(`\'`)
sparam := param.trim('\'')
params_gen += '${qprefix}params[$i] = "$sparam";\n'
} else {
// A variable like q.nr_orders

View File

@ -28,8 +28,8 @@ fn test_flag_parsing() {
}
}
arg := if lowest != -1 {
rest = base.right(lowest).trim_space().trim(`,`)
base.left(lowest).trim_space().trim(`,`)
rest = base.right(lowest).trim_space().trim(',')
base.left(lowest).trim_space().trim(',')
} else {
rest = ''
base.trim_space()