I have an array of strings, most of which are string values "true" or "false", there are other strings there but i don't wish to alter them.
So i wish to loop through the strings and where i encounter the word "true" or "false" i want to change the string to "1" or "0"
These strings of 1, 0 and others will end up being used as parameters passed to a SQL stored procedure IE: seCmd.Parameters["@CheckListRef"].Value = data[0];
I am merely struggling with the syntax and therefore seeking guidence
string[] data = args.Trim().Split(',');
// Loop over strings
foreach (string s in data)
{
if(s == "true")
{
convert the string True to the string 1
}
else if(s == "false")
{
convert the string True to the string 0
}
}
please can someone offer some guidance