c# - Errors when I split a string -
this question has answer here:
- confusing error when splitting string 4 answers
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
Post a Comment