Class StringExtensions
String extension methods.
Inheritance
Inherited Members
Namespace: StansAssets.Foundation.Extensions
Assembly: cs.temp.dll.dll
Syntax
public static class StringExtensions
Methods
AllIndexesOf(String, String, StringComparison)
Method will return all the indexes for a matched string.
Declaration
public static List<int> AllIndexesOf(this string source, string value, StringComparison comparisonType)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Source string. |
System.String | value | String Value to look for. |
System.StringComparison | comparisonType | Comparison Type. |
Returns
Type | Description |
---|---|
List<System.Int32> | Indexes for a matched string. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
CopyToClipboard(String)
Copy specified string to the system copy buffer.
Declaration
public static void CopyToClipboard(this string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
|
GetFirst(String, Int32)
Retrieves specified symbols amount from the beginning of the string.
Declaration
public static string GetFirst(this string source, int count)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Source string. |
System.Int32 | count | Amount of symbols |
Returns
Type | Description |
---|---|
System.String | Specified symbols amount from the beginning of the string. |
GetLast(String, Int32)
Retrieves specified symbols amount from the end of the string.
Declaration
public static string GetLast(this string source, int count)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Source string. |
System.Int32 | count | Amount of symbols |
Returns
Type | Description |
---|---|
System.String | Specified symbols amount from the end of the string. |
RemoveLast(String, Int32)
Removes specified symbols amount from the end of the string.
Declaration
public static string RemoveLast(this string source, int count)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | Source string. |
System.Int32 | count | Amount of symbols |
Returns
Type | Description |
---|---|
System.String | Modified string. |
TrimEnd(String, String)
Removes all the trailing occurrences of specified string from the current string.
Declaration
public static string TrimEnd(this string target, string trimString)
Parameters
Type | Name | Description |
---|---|---|
System.String | target | Current string |
System.String | trimString | A string to remove. |
Returns
Type | Description |
---|---|
System.String | The string that remains after all occurrences of trimString parameter are removed from the end of the current string. |
TrimStart(String, String)
Removes all the leading occurrences of specified string from the current string.
Declaration
public static string TrimStart(this string target, string trimString)
Parameters
Type | Name | Description |
---|---|---|
System.String | target | Current string. |
System.String | trimString | A string to remove. |
Returns
Type | Description |
---|---|
System.String | The string that remains after all occurrences of trimString parameter are removed from the start of the current string. |