Class Strings
Extension methods related to FTP tasks
public static class Strings
- Inheritance
-
Strings
- Inherited Members
Methods
AddPrefix(List<string>, string, bool)
Adds a prefix to the given strings, returns a new array.
public static List<string> AddPrefix(this List<string> values, string prefix, bool trim = false)
Parameters
Returns
AddPrefix(string[], string, bool)
Adds a prefix to the given strings, returns a new array.
public static string[] AddPrefix(this string[] values, string prefix, bool trim = false)
Parameters
Returns
- string[]
ContainsAny(string, string[], int)
Checks if the string contains any of the given values
public static bool ContainsAny(this string field, string[] values, int afterChar = -1)
Parameters
Returns
ContainsAnyCI(string, string[])
Checks if the reply contains any of the known error strings, by checking in case-insensitive manner.
public static bool ContainsAnyCI(this string reply, string[] strings)
Parameters
Returns
ContainsCI(string, string)
Checks if the string contains the given substring in a case-insensitive manner.
public static bool ContainsCI(this string value, string substring)
Parameters
Returns
EndsWithCI(string, string)
Checks if the string ends with the given substring in a case-insensitive manner.
public static bool EndsWithCI(this string value, string substring)
Parameters
Returns
EnsurePostfix(string, string)
Ensure a string has the given postfix
public static string EnsurePostfix(this string text, string postfix)
Parameters
Returns
EnsurePrefix(string, string)
Ensure a string has the given prefix
public static string EnsurePrefix(this string text, string prefix)
Parameters
Returns
EqualsAny(string, string[])
Checks if the string equals any of these values, by checking in case-sensitive manner.
public static bool EqualsAny(this string text, string[] strings)
Parameters
Returns
EscapeStringLiteral(string)
Escape a string into a valid C# string literal. Implementation from StackOverflow - https://stackoverflow.com/a/14087738
public static string EscapeStringLiteral(this string input)
Parameters
input
string
Returns
IsBlank(string)
Checks if the string is null or 0 length.
public static bool IsBlank(this string value)
Parameters
value
string
Returns
IsNullOrWhiteSpace(string)
Checks if every character in the string is whitespace, or the string is null.
public static bool IsNullOrWhiteSpace(string value)
Parameters
value
string
Returns
IsNumeric(string)
Checks if all the characters in this string are digits or dots
public static bool IsNumeric(this string field)
Parameters
field
string
Returns
IsValidRegEx(string)
Checks if RexEx Pattern is valid
public static bool IsValidRegEx(this string pattern)
Parameters
pattern
string
Returns
Join(List<string>, string)
Join the given strings by a delimiter.
public static string Join(this List<string> values, string delimiter)
Parameters
Returns
Join(string[], string)
Join the given strings by a delimiter.
public static string Join(this string[] values, string delimiter)
Parameters
Returns
RemovePostfix(string, string)
Remove a postfix from a string, only if it has the given postfix
public static string RemovePostfix(this string text, string postfix)
Parameters
Returns
RemovePrefix(string, string)
Remove a prefix from a string, only if it has the given prefix
public static string RemovePrefix(this string text, string prefix)
Parameters
Returns
SplitString(string)
Split into fields by splitting on tokens
public static string[] SplitString(this string str)
Parameters
str
string
Returns
- string[]
StartsWithCI(string, string)
Checks if the string starts with the given substring in a case-insensitive manner.
public static bool StartsWithCI(this string value, string substring)