StringSplitOptions.RemoveEmptyEntries doesn’t work as advertised

Most likely because you change the string after the split. You trim the values after splitting them, RemoveEmptyEntries doesn’t consider the string " " empty.

The following would achieve what you want, basically creating your own strip empty elements:

var tagsSplit = tags.Split(',').
                  Select(tag => tag.Trim()). 
                  Where( tag => !string.IsNullOrEmpty(tag));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)