I am trying to break a line containing the sequence "Song title - artist name". I did similar string manipulations in PHP with relative ease, as shown below.
PHP:
$titledata = explode(" - ", $title);
This is what I am trying to use in C #:
string[] titledata = title.Split(" - ");
And it returns the error “Unable to convert from“ string ”to“ char []. ”I tried using ToCharArray (), and while it works, it doesn’t work correctly. I'm not sure if this is a problem with the minus sign or the number of characters used in as a separator.
source
share