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:
- The list is converted to lower case using ToLowerInvariant().
- The list is trimmed for whitespace.
- Any single spaces preceding/following a semi-colon are removed.
- 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
)
Public Shared Function PreprocessSemiList (
list As String
) As String
Parameters
- list
- Type: SystemString
The list to pre-process.
Return Value
Type:
StringThe 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