Cleans a string with a set of cleaning rules.
Namespace: CleanCode.DataAssembly: CleanCode (in CleanCode.dll) Version: 1.2.3.0 (1.2.03)
public static string CleanString(
string dirtyString,
string[,] cleanRules
)
Public Shared Function CleanString ( _
dirtyString As String, _
cleanRules As String(,) _
) As String
Public Shared Function CleanString ( _
dirtyString As String, _
cleanRules As String(,) _
) As String
public:
static String^ CleanString(
String^ dirtyString,
array<String^,2>^ cleanRules
)
Parameters
- dirtyString
- Type: System String
The dirty string.
- cleanRules
- Type: System 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.