Table of Contents

Class Strings

Namespace
FluentFTP.Helpers
Assembly
FluentFTP.dll

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

values List<string>
prefix string
trim bool

Returns

List<string>

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

values string[]
prefix string
trim bool

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

field string
values string[]
afterChar int

Returns

bool

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

reply string
strings string[]

Returns

bool

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

value string
substring string

Returns

bool

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

value string
substring string

Returns

bool

EnsurePostfix(string, string)

Ensure a string has the given postfix

public static string EnsurePostfix(this string text, string postfix)

Parameters

text string
postfix string

Returns

string

EnsurePrefix(string, string)

Ensure a string has the given prefix

public static string EnsurePrefix(this string text, string prefix)

Parameters

text string
prefix string

Returns

string

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

text string
strings string[]

Returns

bool

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

string

IsBlank(string)

Checks if the string is null or 0 length.

public static bool IsBlank(this string value)

Parameters

value string

Returns

bool

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

bool

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

bool

IsValidRegEx(string)

Checks if RexEx Pattern is valid

public static bool IsValidRegEx(this string pattern)

Parameters

pattern string

Returns

bool

Join(List<string>, string)

Join the given strings by a delimiter.

public static string Join(this List<string> values, string delimiter)

Parameters

values List<string>
delimiter string

Returns

string

Join(string[], string)

Join the given strings by a delimiter.

public static string Join(this string[] values, string delimiter)

Parameters

values string[]
delimiter string

Returns

string

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

text string
postfix string

Returns

string

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

text string
prefix string

Returns

string

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)

Parameters

value string
substring string

Returns

bool