Splitting string by two conditions in vb.net 2014 -
i'm trying split string list of strings vb.net code, while adding dictionary of string:
objevt.wbstr.add(b, objevt.metalbelowwidth.item(b).split({",","-"}).tolist)
but error saying "value of '1-dimentitional arrary of string' cannot converted 'char' "
if try implement splitting comma, works fine. following code works. objevt.wbstr.add(b, objevt.metalbelowwidth.item(b).split(",").tolist)
but want split string 2 conditions. appreciated. thanks!
one of overloads of split
method takes string array needs have stringsplitoption
parameter set.
objevt.wbstr.add(b, objevt.metalbelowwidth.item(b).split(new string() {",", "-"}, stringsplitoptions.none).tolist) sub main() dim mystring string = "h,c,j-hello-world" dim mylist list(of string) = new list(of string) mylist = mystring.split(new string() {"-", ","}, stringsplitoptions.none).tolist each s string in mylist console.writeline(s) next console.readline() end sub
Comments
Post a Comment