I have the following stored in a string.
var _status = "Unknown,Enabled,DisabledAccount,Enabled,Password Does Not Expire,Disabled,Password Does Not Expire,Enabled, Password Does Not Expire"
Desired string so that I can use it in MySQL IN Statement.
var stat = "'Unknown','Enabled','Disabled Account','Enabled, Password Does Not Expire','Disabled, Password Does Not Expire','Enabled, Password Does Not Expire'"
My Code:
string stat = "";
string[] devices = _status.Split(',');
foreach (var d in devices)
{
stat += "'" + d + "',";
}
stat = stat.TrimEnd(',');
Output
var stat = "'Unknown','Enabled','Disabled Account','Enabled',' Password Does Not Expire','Disabled',' Password Does Not Expire','Enabled',' Password Does Not Expire '"
Thanks