EmailParsing | FilenameParsing |
NumberParsing | UrlParsing |
Assists with email parsing tasks.
Indicates whether or not the specified email address is in a valid format.
Name | Description |
---|---|
System.String The email address. |
True, if the email address is in a valid format; otherwise, false.
This code is based on this Stack Overflow answer: http://stackoverflow.com/a/1374644/2052963
Assists with filename parsing tasks.
Static constructor.
The characters to exclude when sanitizing filenames.
Sanitizes a source string for use as a filename.
Name | Description |
---|---|
source | System.String The source string to sanitize. |
replaceChar | System.String Optional. The character to use to replace invalid characters. If unspecified, invalid characters will be removed entirely. |
The sanitized string.
For extra safety, this will exclude some characters that are not strictly prohibited from being part of filenames (e.g., the period character).
Assists with number parsing tasks.
Attempts to parse an integer.
Name | Description |
---|---|
value | System.String The string version of the integer. |
The integer, if it could be parsed; otherwise, null.
Assists with URL parsing tasks.
Static constructor.
The regex used to match the first segment of a path.
Safely extracts the path and query string portion from a URL, regardless of whether or not that URL has a domain.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/some-path?some=query"). |
The path (e.g., "/some-path?some=query").
Safely extracts the path portion from a URL, regardless of whether or not that URL has a domain.
Name | Description |
---|---|
url | System.String The URL (e.g., "http://www.rhythmagency.com/some-path?some=query"). |
The path (e.g., "/some-path").
Will not include the query string.
Removes the first segment from a URL path.
Name | Description |
---|---|
path | System.String The path (e.g., "/unwanted-segment/about/company"). |
The path without the first segment (e.g., "/about/company").