Source/NFX/DataAccess/CRUD/Row.cs
/// <summary>
/// Returns true if this row satisfies simple filter - it contains the supplied filter string.
/// The filter pattern may start or end with "*" char that denotes a wildcard. A wildcard is permitted on both sides of the filter value
/// </summary>
Returns true if this row satisfies simple filter - it contains the supplied filter string.
The filter pattern may start or end with "*" char that denotes a wildcard. A wildcard is permitted on both sides of the filter value
Returns true if this row satisfies simple filter - it contains the supplied filter string . The filter pattern may start or end with " * " char that denotes a wildcard . A wildcard is permitted on both sides of the filter value
public bool SimpleFilterPredicate(string filter, bool caseSensitive = false)
            {
              if (filter==null) return false;
              if (!caseSensitive)
                filter = filter.ToUpperInvariant();
              var sany = false;
              var eany = false;
              if (filter.StartsWith("*"))
              {
                sany = true;
                filter = filter.Remove(0, 1);
              }
              if (filter.EndsWith("*"))
              {
                eany = true;
                filter = filter.Remove(filter.Length-1, 1);
              }
              foreach(var val in this)
              {
                 if (val==null) continue;
                 var sval = val.ToString();
                 if (!caseSensitive)
                    sval = sval.ToUpperInvariant();
                 if (sany && eany && sval.Contains(filter)) return true;
                 if (!sany && eany && sval.StartsWith(filter)) return true;
                 if (sany && !eany && sval.EndsWith(filter)) return true;
                 if (!sany && !eany && sval==filter) return true;
              }
              return false;
            }
public bool SimpleFilterPredicate ( string filter , bool caseSensitive = false ) { if ( filter == null ) return false ; if ( ! caseSensitive ) filter = filter . ToUpperInvariant ( ) ; var sany = false ; var eany = false ; if ( filter . StartsWith ( " " ) ) { sany = true ; filter = filter . Remove ( 0 , 1 ) ; } if ( filter . EndsWith ( " " ) ) { eany = true ; filter = filter . Remove ( filter . Length - 1 , 1 ) ; } foreach ( var val in this ) { if ( val == null ) continue ; var sval = val . ToString ( ) ; if ( ! caseSensitive ) sval = sval . ToUpperInvariant ( ) ; if ( sany && eany && sval . Contains ( filter ) ) return true ; if ( ! sany && eany && sval . StartsWith ( filter ) ) return true ; if ( sany && ! eany && sval . EndsWith ( filter ) ) return true ; if ( ! sany && ! eany && sval == filter ) return true ; } return false ; }
Returns true if this row satisfies simple filter - it contains the supplied filter string.
Returns true if this row satisfies simple filter - it contains the supplied filter string .
filter
string
caseSensitive
bool