Click or drag to resize

StringUtilsToSymbolExtended Method

Converts a string to a symbol string by removing, or replacing if a replacement string is provided, all characters except for a-z, A-Z, 0-9, "_", and any characters provided in additionalChars. Note that at this time the additionalChars string is simply added to the RegEx expression ("[^\\w" + additionalChars + "]+") and so care should be taken that such characters do not break the expression. The result is a string suitable for an identifier in HTML or elsewhere.

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public static string ToSymbolExtended(
	string s,
	string additionalChars,
	string replacement = ""
)

Parameters

s
Type: SystemString
The string to convert.
additionalChars
Type: SystemString
Additional characters to allow - use caution.
replacement (Optional)
Type: SystemString
The character with which to replace offending characters.

Return Value

Type: String
The symbol with offending characters removed.
Remarks
Note that "_" is not quite accurate. Actually the RegEx "\w" word character is used which, in addition to alphanumerics, allows Pc (any Unicode Characters in the 'Punctuation, Connector' Category). The only common such character in English is the underbar ("_"), but there are a number of other uncommon connectors allowed.
See Also