Click or drag to resize

StringUtilsPreprocessSemiList Method

Pre-process a semi-colon-separated list of items to make it easier to search for inclusion. If the list is null/empty it is returned unchanged otherwise the following processing is performed:
  1. The list is converted to lower case using ToLowerInvariant().
  2. The list is trimmed for whitespace.
  3. Any single spaces preceding/following a semi-colon are removed.
  4. The list is wrapped in outer semi-colons.

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public static string PreprocessSemiList(
	string list
)

Parameters

list
Type: SystemString
The list to pre-process.

Return Value

Type: String
The pre-processed list or null/empty.
Remarks
This allows for easily and reliably determining if the resulting list contains specified fields by using a test like if (list.Contains(";" + fld.Key.ToLowerInvariant() + ";") {}. This type of test ensures that a test for the item "name" will not find a match in a list containing the "last_name" since the search test will effectively be something like if (";first_name;last_name;".Contains(";name;")) {}
See Also