c# - Split a string by a character -


i have string here:

string filenameorginal = "lighthouse-126.jpg"; 

and trying split string 2, seperating "-"

i have tried following, syntax error on spilt:

string filenameorginal = drproduct["producthtml"].tostring(); string[] strdataarray = filenameorginal.split("-"); 

please help, not understand doing wrong.

you need character instead of string:

string[] strdataarray = filenameorginal.split('-'); 

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -