Class StringExtensions
Class holding extension methods on the System.string class
Inheritance
Namespace: PnP.Framework.Modernization.Extensions
Assembly: PnP.Framework.dll
Syntax
public static class StringExtensions : object
Methods
CleanForJSON(String)
Prepares a string for json inclusion Copied from https://stackoverflow.com/questions/1242118/how-to-escape-json-string
Declaration
public static string CleanForJSON(this string s)
Parameters
System. string to prepare |
Returns
System. json ready string |
ContainsIgnoringCasing(String, String, StringComparison)
Determines if a string exists in another string regardless of casing
Declaration
public static bool ContainsIgnoringCasing(this string value, string comparedWith, StringComparison stringComparison = null)
Parameters
System. original string |
System. string to compare with |
String optional comparison mode |
Returns
System.
|
GetBaseUrl(String)
Gets base url from string
Declaration
public static string GetBaseUrl(this string url)
Parameters
System.
|
Returns
System.
|
GetTypeShort(String)
Get type in short form
Declaration
public static string GetTypeShort(this string typeValue)
Parameters
System.
|
Returns
System.
|
GetUserName(String)
Gets the user name from a provided login name
Declaration
public static string GetUserName(this string loginName)
Parameters
System. Login name |
Returns
System. User name |
InferClassNameFromNameSpace(String)
Gets classname from type
Declaration
public static string InferClassNameFromNameSpace(this string typeName)
Parameters
System.
|
Returns
System.
|
PrependIfNotNull(String, String)
Prepends string to another including null checking
Declaration
public static string PrependIfNotNull(this string value, string prependString)
Parameters
System.
|
System.
|
Returns
System.
|
Replace(String, String, String, StringComparison)
Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string according the type of search to use for the specified string. Copied from https://stackoverflow.com/questions/6275980/string-replace-ignoring-case
Declaration
public static string Replace(this string str, string oldValue, string newValue, StringComparison comparisonType)
Parameters
System. The string performing the replace method. |
System. The string to be replaced. |
System. The string replace all occurrences of |
String One of the enumeration values that specifies the rules for the search. |
Returns
System. A string that is equivalent to the current string except that all instances of |
StripRelativeUrlSectionString(String)
Removes a relative section of by string where context not available
Declaration
public static string StripRelativeUrlSectionString(this string value)
Parameters
System.
|
Returns
System.
|