Provides for commons language types.
Cut the string if it is larger than 20 characters adding an ellipse at the end.
public String Ellipse(text)
Name | Type | Summary |
---|---|---|
text | String | Text to ellipse. |
Cut the string if it is larger than the maxLength adding an ellipse at the end.
public String Ellipse(text, maxLength)
Name | Type | Summary |
---|---|---|
text | String | Text to ellipse. |
maxLength | Int32 | Maximum length of the returned string. |
Ensures that the text ends with a slash.
public String EnsureTrailingSlash(text)
Name | Type | Summary |
---|---|---|
text | String | A text to process. |
Returns a collection of properties that have the specified attribute.
public IEnumerable<PropertyInfo> GetPropertiesWithAttribute<T>(type)
An enumeration of PropertyInfo objects.
Name | Type | Summary |
---|---|---|
type | Type | The type to be scanned. |
Returns the first property that has the specified attribute.
public PropertyInfo GetPropertyWithAttribute<T>(type)
Name | Type | Summary |
---|---|---|
type | Type | The type to be scanned. |
Returns the first property that has the specified attribute if it is assignable from the specified type.
public PropertyInfo GetPropertyWithAttributeAssignableFrom<T>(type, assignableFrom)
Name | Type | Summary |
---|---|---|
type | Type | The type to be scanned. |
assignableFrom | Type | Type from which teh attribute must be assignable from. |
Gets the scheme host and path of the Uri.
public String GetSchemeHostAndPath(uri)
The scheme and host from the Uri.
Name | Type | Summary |
---|---|---|
uri | Uri | An Uri. |
Converts a string in hexadecimal format into a byte array.
public Byte[] HexStringToByteArray(input)
A byte array for the specified input.
Name | Type | Summary |
---|---|---|
input | String | A hexadeciamal text to process. |
Type | Summary |
---|---|
ArgumentException | Thrown then the length of the input is not multiple of 2. |
Returns the first letter of the first and last word in value.
public String Initials(value)
The upper case of the first letter from the first and last word of value.
Name | Type | Summary |
---|---|---|
value | String | A space separated value. |
Remove accents from the phrase.
public String RemoveAccent(phrase)
Name | Type | Summary |
---|---|---|
phrase | String | A phrase to remove the accent characters. |
Type | Summary |
---|---|
ArgumentNullException | Thrown when phrase is null. |
Remove all trailing slashes from the text.
public String RemoveTrailingSlash(text)
Name | Type | Summary |
---|---|---|
text | String | A text to process. |
Replaces curly braces placeholder within the string, with the ToString() result from the values of the specified dictionary.
Placeholder must by in the format: {Key}.
public String Replace(value, values)
Name | Type | Summary |
---|---|---|
value | String | A curly braces tagged text. |
values | IDictionary<String, Object> | A dictionary with replacement values. |
Replaces curly braces placeholder within the string with the ToString() result from the values of the specified object.
Placeholder must by in the format: {PropertyName}.
public String Replace(value, values)
Name | Type | Summary |
---|---|---|
value | String | A curly braces tagged text. |
values | Object | A dictionary with replacement values. |
Split a comma separated string and trim each individual value, empty strings won't be added to the array.
public String[] SplitAndTrim(value)
Name | Type | Summary |
---|---|---|
value | String | A text value to be splitted. |
Split a comma separated string and trim each individual value, empty strings won't be added to the array.
public String[] SplitAndTrim(value, separator)
Name | Type | Summary |
---|---|---|
value | String | A text value to be splitted. |
separator | Char[] | The separator to split the text with. |
Maps a generic object to a key/value dictionary.
public IDictionary<String, Object> ToDictionary(values)
A string/object dictionary with an element for each object property.
Name | Type | Summary |
---|---|---|
values | Object | An object to be converted. |
Generate a slug from the phrase.
public String ToSlug(phrase)
A lower case phrase with:
- underscores and dots replaced with dashes.
- slashes replaced with dashes.
- non alpha-numeric characters removed.
- spaces trimmed and replaced with dashes.
Name | Type | Summary |
---|---|---|
phrase | String | A phrase to be slugged. |
Converts the list to a space separated string.
public String ToSpaceSeparatedString(list)
Name | Type | Summary |
---|---|---|
list | IEnumerable<String> | A list to join into a string. |
Turns the string into a stream.
public Stream ToStream(value)
Name | Type | Summary |
---|---|---|
value | String | A string to be converted into a stream. |
Truncates the milliseconds of a DateTime.
public DateTime Truncate(dateTime)
A truncated DateTime.
Name | Type | Summary |
---|---|---|
dateTime | DateTime | A DateTime to be truncated. |
Trunctates a DateTime to a specified resolution.
public DateTime Truncate(dateTime, resolution)
A truncated DateTime.
Name | Type | Summary |
---|---|---|
dateTime | DateTime | A DateTime to be truncated. |
resolution | Int64 | The required truncation resolution. |
In this document