How can i check if filename contains some string? for example if "frody" contains "ro"? I tried like that:
if (file_name.Contains("ro")== true)
and:
if (file_name.Contains("ro"))
How can i check if filename contains some string? for example if "frody" contains "ro"? I tried like that:
if (file_name.Contains("ro")== true)
and:
if (file_name.Contains("ro"))
Both are correct. The second is probably more favoured.
E.g., this returns true:
string s = "test-ro.doc";
Console.WriteLine(s.Contains("ro"));
if (s == null || s.Trim().Length == 0) { return false } else { return s.ToLower().Contains("ro"); }