Show / Hide Table of Contents

Class Strings

Extension method equivalents to static methods from String.

Inheritance
Object
Strings
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Hgk.Zero.Strings
Assembly: Hgk.Zero.Strings.dll
Syntax
public static class Strings

Methods

| Improve this Doc View Source

ConcatString(String, IEnumerable<String>)

Concatenates a string to the elements of a string sequence.

Declaration
public static string ConcatString(this string str, IEnumerable<string> values)
Parameters
Type Name Description
String str

The first value to concatenate.

IEnumerable<String> values

The other values to concatenate.

Returns
Type Description
String

The concatenation of str and the strings in values.

Remarks

If str is null or empty, this method returns the result of calling Concat(IEnumerable<String>). Otherwise, Concat(IEnumerable<String>) is called on the result of prepending str to values.

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

ConcatString(String, Object)

Concatenates a string to the string representations of another object.

Declaration
public static string ConcatString(this string str, object arg0)
Parameters
Type Name Description
String str

The first value to concatenate.

Object arg0

The second value to concatenate.

Returns
Type Description
String

The concatenation of str and arg0.

Remarks

This method returns the result of calling Concat(Object, Object).

| Improve this Doc View Source

ConcatString(String, Object, Object)

Concatenates a string to the string representations of two other objects.

Declaration
public static string ConcatString(this string str, object arg0, object arg1)
Parameters
Type Name Description
String str

The first value to concatenate.

Object arg0

The second value to concatenate.

Object arg1

The third value to concatenate.

Returns
Type Description
String

The concatenation of str, arg0, and arg1.

Remarks

This method returns the result of calling Concat(Object, Object, Object).

| Improve this Doc View Source

ConcatString(String, Object, Object, Object)

Concatenates a string to the string representations of three other objects.

Declaration
public static string ConcatString(this string str, object arg0, object arg1, object arg2)
Parameters
Type Name Description
String str

The first value to concatenate.

Object arg0

The second value to concatenate.

Object arg1

The third value to concatenate.

Object arg2

The fourth value to concatenate.

Returns
Type Description
String

The concatenation of str, arg0, arg1, and arg2.

Remarks

This method concatenates str to the result of calling Concat(Object, Object, Object).

| Improve this Doc View Source

ConcatString(String, Object[])

Concatenates a string to the string representations of the elements of an object array.

Declaration
public static string ConcatString(this string str, params object[] args)
Parameters
Type Name Description
String str

The first value to concatenate.

Object[] args

The other values to concatenate.

Returns
Type Description
String

The concatenation of str and the values in args.

Remarks

If str is null or empty, this method returns the result of calling Concat(Object[]). Otherwise, Concat<T>(IEnumerable<T>) is called on the result of prepending str to args.

Exceptions
Type Condition
ArgumentNullException

args is null.

| Improve this Doc View Source

ConcatString(String, String)

Concatenates a string to another string.

Declaration
public static string ConcatString(this string str0, string str1)
Parameters
Type Name Description
String str0

The first string value to concatenate.

String str1

The second string value to concatenate.

Returns
Type Description
String

The concatenation of str0 and str1.

Remarks

This method returns the result of calling Concat(String, String).

| Improve this Doc View Source

ConcatString(String, String, String)

Concatenates a string to two other strings.

Declaration
public static string ConcatString(this string str0, string str1, string str2)
Parameters
Type Name Description
String str0

The first string value to concatenate.

String str1

The second string value to concatenate.

String str2

The third string value to concatenate.

Returns
Type Description
String

The concatenation of str0, str1, and str2.

Remarks

This method returns the result of calling Concat(String, String, String).

| Improve this Doc View Source

ConcatString(String, String, String, String)

Concatenates a string to three other strings.

Declaration
public static string ConcatString(this string str0, string str1, string str2, string str3)
Parameters
Type Name Description
String str0

The first string value to concatenate.

String str1

The second string value to concatenate.

String str2

The third string value to concatenate.

String str3

The fourth string value to concatenate.

Returns
Type Description
String

The concatenation of str0, str1, str2, and str3.

Remarks

This method returns the result of calling Concat(String, String, String, String).

| Improve this Doc View Source

ConcatString(String, String[])

Concatenates a string to the elements of a string array.

Declaration
public static string ConcatString(this string str, params string[] values)
Parameters
Type Name Description
String str

The first string value to concatenate.

String[] values

The other string values to concatenate.

Returns
Type Description
String

The concatenation of str and the strings in values.

Remarks

If str is null or empty, this method returns the result of calling Concat(String[]). Otherwise, Concat(IEnumerable<String>) is called on the result of prepending str to values.

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

ConcatString<T>(String, IEnumerable<T>)

Concatenates a string to the string representations of the elements of a sequence.

Declaration
public static string ConcatString<T>(this string str, IEnumerable<T> values)
Parameters
Type Name Description
String str

The first value to concatenate.

IEnumerable<T> values

The other values to concatenate.

Returns
Type Description
String

The concatenation of str and the values in values.

Type Parameters
Name Description
T

The type of the elements of values.

Remarks

If str is null or empty, this method returns the result of calling Concat<T>(IEnumerable<T>). Otherwise, Concat<T>(IEnumerable<T>) is called on the result of converting values to an Object sequence and prepending str to the sequence.

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

IsNullOrEmpty(String)

Returns whether the specified string is null or empty (zero-length).

Declaration
public static bool IsNullOrEmpty(this string value)
Parameters
Type Name Description
String value

A string to test.

Returns
Type Description
Boolean

true if value is null or a zero-length string; otherwise, false.

Remarks

This method returns the result of calling IsNullOrEmpty(String).

| Improve this Doc View Source

IsNullOrWhiteSpace(String)

Returns whether the specified string is null, empty (zero-length), or contains only whitespace characters.

Declaration
public static bool IsNullOrWhiteSpace(this string value)
Parameters
Type Name Description
String value

A string to test.

Returns
Type Description
Boolean

true if value is null, a zero-length string, or a string containing only whitespace characters; otherwise, false.

Remarks

A character is a whitespace character if the result of calling IsWhiteSpace(Char) on the character is true.

This method returns the result of IsNullOrWhiteSpace(String).

| Improve this Doc View Source

JoinString(String, IEnumerable<String>)

Concatenates the elements of a string sequence using the specified string as a separator.

Declaration
public static string JoinString(this string separator, IEnumerable<string> values)
Parameters
Type Name Description
String separator

A string to use as a separator. (If null, an empty string is used.)

IEnumerable<String> values

The strings to concatenate.

Returns
Type Description
String

The concatenation of the values in values, delimited by separator, if values contains any elements; otherwise, an empty string.

Remarks

This method returns the result of calling Join(String, IEnumerable<String>).

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

JoinString(String, Object[])

Concatenates the string representations of the elements of an array using the specified string as a separator.

Declaration
public static string JoinString(this string separator, params object[] values)
Parameters
Type Name Description
String separator

A string to use as a separator. (If null, an empty string is used.)

Object[] values

The values to concatenate.

Returns
Type Description
String

The concatenation of the string representations of the values in values, delimited by separator, if values contains any elements; otherwise, an empty string.

Remarks

This method returns the result of calling Join(String, Object[]).

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

JoinString(String, String[])

Concatenates the elements of a string array using the specified string as a separator.

Declaration
public static string JoinString(this string separator, params string[] values)
Parameters
Type Name Description
String separator

A string to use as a separator. (If null, an empty string is used.)

String[] values

The strings to concatenate.

Returns
Type Description
String

The concatenation of the values in values, delimited by separator, if values contains any elements; otherwise, an empty string.

Remarks

This method returns the result of calling Join(String, String[]).

Exceptions
Type Condition
ArgumentNullException

values is null.

| Improve this Doc View Source

JoinString(String, String[], Int32, Int32)

Concatenates the specified elements of a string array using the specified string as a separator.

Declaration
public static string JoinString(this string separator, string[] values, int startIndex, int count)
Parameters
Type Name Description
String separator

A string to use as a separator. (If null, an empty string is used.)

String[] values

An array containing strings to concatenate.

Int32 startIndex

The first index of values to use.

Int32 count

The number of elements of values to use.

Returns
Type Description
String

The concatenation of the values in the specified range of values, delimited by separator, if the specified range contains any elements; otherwise, an empty string.

Remarks

This method returns the result of calling Join(String, String[], Int32, Int32).

Exceptions
Type Condition
ArgumentNullException

values is null.

ArgumentOutOfRangeException

startIndex or count is less than 0, or startIndex plus count is greater than the length of values.

| Improve this Doc View Source

JoinString<T>(String, IEnumerable<T>)

Concatenates the string representations of the elements of a sequence using the specified string as a separator.

Declaration
public static string JoinString<T>(this string separator, IEnumerable<T> values)
Parameters
Type Name Description
String separator

A string to use as a separator. (If null, an empty string is used.)

IEnumerable<T> values

The values to concatenate.

Returns
Type Description
String

The concatenation of the string representations of the values in values, delimited by separator, if values contains any elements; otherwise, an empty string.

Type Parameters
Name Description
T

The type of elements of values.

Remarks

This method returns the result of calling Join<T>(String, IEnumerable<T>).

Exceptions
Type Condition
ArgumentNullException

values is null.

  • Improve this Doc
  • View Source
Back to top Copyright © 2018-2019 Peter S. May
Generated by DocFX