Utility CleanString Method CleanCode C# Libraries v1.2.03 API
Cleans a string with a set of cleaning rules.

Namespace: CleanCode.Data
Assembly: CleanCode (in CleanCode.dll) Version: (1.2.03)

public static string CleanString(
	string dirtyString,
	string[,] cleanRules


Type: OnlineSystem String
The dirty string.
Type:  OnlineSystem String 
The cleaning rules, in the form of a two-dimensional string array. The parent array contains a sequence of two-element child arrays. Each child array specifies a match string and a replacement string.

Return Value

Cleaned and pruned string.


This method reduces a string size by pruning or altering specified elements that add no value. Consider, for example, a method that returns the name of the operating system on which your application runs. You might get a value such as "Microsoft(R) Windows XP Professional 5.91". But a cleaned/pruned version of "WinXP Pro 5.91" provides the same information in a shorter string. In this case the cleaning rules include:
  • Delete Microsoft
  • Delete (R)
  • Change Professional to Pro
  • Change Windows to Win
Also, whitespace is condensed or eliminated as much as possible.
See Also