Class StringExtensions
Inheritance
System.Object
StringExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Hsl.Xrm.Sdk
Assembly: Hsl.Xrm.Sdk.Core.dll
Syntax
public static class StringExtensions
Methods
Deobfuscate(String, String)
Declaration
public static string Deobfuscate(this string target, string salt = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | target | |
System.String | salt |
Returns
Type | Description |
---|---|
System.String |
Obfuscate(String, String)
Note that this method, without a salt, provides obfuscation but should not be considered cryptologically secure.
Declaration
public static string Obfuscate(this string target, string salt = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | target | |
System.String | salt |
Returns
Type | Description |
---|---|
System.String |
ParseEnumOrDefault<T>(String, T)
Parses a string into an enum value or returns the default value specified.
Declaration
public static T ParseEnumOrDefault<T>(this string value, T defaultValue)
where T : struct
Parameters
Type | Name | Description |
---|---|---|
System.String | value | |
T | defaultValue |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
RandomString(Int32, RandomStringOptions, Char[], Char[])
Declaration
public static string RandomString(int length, RandomStringOptions options, char[] exclusions = null, char[] inclusions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | length | |
RandomStringOptions | options | |
System.Char[] | exclusions | |
System.Char[] | inclusions |
Returns
Type | Description |
---|---|
System.String |
Truncate(String, Int32)
Truncates a string to the maximum length specified.
Declaration
public static string Truncate(this string target, int maxLength)
Parameters
Type | Name | Description |
---|---|---|
System.String | target | |
System.Int32 | maxLength |
Returns
Type | Description |
---|---|
System.String |