V: substr, right, left string methods are no longer public

Created on 3 Dec 2019  路  2Comments  路  Source: vlang/v

V version: V 0.1.23 c4a4363
OS: windows 10 (1909)

What did you do?
test substr, right, left string methods using REPL

What did you expect to see?

a := 'aabbcc'
println(a.substr(2,4))
bb
println(a.right(2))
bbcc
println(a.left(2))
aa

What did you see instead?

a := 'aabbcc'
println(a.substr(2,4))
.vrepl.v:2:16: function substr is private

println(a.right(2))
.vrepl.v:2:15: function right is private

println(a.left(2))
.vrepl.v:2:14: function left is private

Bug

Most helpful comment

Hello elimisteve,

Sorry, i did't see the 0.1.23 new slicing syntax.

Thanks

All 2 comments

Hi @progamateur , as per the last line of the top of https://github.com/vlang/v/issues/2932 --

string/array.left/right/slice/substr were removed ([a..b] slicing syntax should be used instead).

That is, instead of

println(a.left(2))

please use

println(a[..2])

and the like :slightly_smiling_face:

Hello elimisteve,

Sorry, i did't see the 0.1.23 new slicing syntax.

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markgraydev picture markgraydev  路  3Comments

XVilka picture XVilka  路  3Comments

choleraehyq picture choleraehyq  路  3Comments

shouji-kazuo picture shouji-kazuo  路  3Comments

ArcDrake picture ArcDrake  路  3Comments