c# - Errors when I split a string -


this question has answer here:

when try split strings, got 2 type of errors:

error   1   best overloaded method match 'string.split(params char[])' has invalid arguments error   2   argument 1: cannot convert 'string' 'char[]' 

this part of code that:

if (string.isnullorempty(data_odd)) {     if (node.getattributevalue("class", "").contains(("first-cell")))         rowbet.match = node.innertext.trim();     var matchteam = rowbet.match.split("-", stringsplitoptions.removeemptyentries);     rowbet.home = matchteam[0];     rowbet.host = matchteam[1];      if (node.getattributevalue("class", "").contains(("result")))         rowbet.result = node.innertext.trim();     var matchpoints = rowbet.result.split(":", stringsplitoptions.removeemptyentries);     rowbet.homepoints = int.parse(matchpoints[0];     rowbet.hostpoints = int.parse(matchpoints[1];      if (node.getattributevalue("class", "").contains(("last-cell")))         rowbet.date = node.innertext.trim(); } 

i don't know how can fix it. hope can me.

edit: homepoints , hostpoints declared int in bet class.

you have pass seperator character, not string (with single quotation marks)

var matchteam = rowbet.match.split("-".tochararray(), stringsplitoptions.removeemptyentries); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -