refactor: Remove unused template param from string join ext fn
This commit is contained in:
1 parent
7c85a226d9
commit
0d0f670629
1 file changed
+42
-39
@@ -1,39 +1,42 @@
|
||||
namespace bts.utils {
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
static class StringExtensions {
|
||||
[Pure]
|
||||
public static string EmptyIfNull(this string str) =>
|
||||
str ?? "";
|
||||
|
||||
[Pure]
|
||||
public static string NullIfEmpty(this string str) =>
|
||||
str == "" ? null : str;
|
||||
|
||||
[Pure]
|
||||
public static bool IsNullOrEmpty(this string str) =>
|
||||
string.IsNullOrEmpty(str);
|
||||
|
||||
public static bool is_null_or_white_space(this string str) =>
|
||||
string.IsNullOrWhiteSpace(str);
|
||||
|
||||
public static bool SafeContains(this string str, string value) =>
|
||||
str != null && str.Contains(value);
|
||||
|
||||
public static string join<T>(this string str, IEnumerable<string> values) =>
|
||||
string.Join(str, values);
|
||||
|
||||
public static string join<T>(this string str, IEnumerable<T> values) =>
|
||||
string.Join(str, values.Select(v => v.ToString()));
|
||||
|
||||
public static string join<T>(
|
||||
this string str,
|
||||
IEnumerable<T> values,
|
||||
string format,
|
||||
IFormatProvider format_provider = null) where T : IFormattable =>
|
||||
string.Join(str, values.Select(v => v.ToString(format, format_provider)));
|
||||
}
|
||||
}
|
||||
namespace bts.utils {
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
static class StringExtensions {
|
||||
[Pure]
|
||||
public static string EmptyIfNull(this string str) =>
|
||||
str ?? "";
|
||||
|
||||
[Pure]
|
||||
public static string NullIfEmpty(this string str) =>
|
||||
str == "" ? null : str;
|
||||
|
||||
[Pure]
|
||||
public static bool IsNullOrEmpty(this string str) =>
|
||||
string.IsNullOrEmpty(str);
|
||||
|
||||
public static bool is_null_or_white_space(this string str) =>
|
||||
string.IsNullOrWhiteSpace(str);
|
||||
|
||||
public static bool SafeContains(this string str, string value) =>
|
||||
str != null && str.Contains(value);
|
||||
|
||||
public static string join(this string str, IEnumerable<string> values) =>
|
||||
string.Join(str, values);
|
||||
|
||||
public static string join<T>(this string str, IEnumerable<string> values) =>
|
||||
string.Join(str, values);
|
||||
|
||||
public static string join<T>(this string str, IEnumerable<T> values) =>
|
||||
string.Join(str, values.Select(v => v.ToString()));
|
||||
|
||||
public static string join<T>(
|
||||
this string str,
|
||||
IEnumerable<T> values,
|
||||
string format,
|
||||
IFormatProvider format_provider = null) where T : IFormattable =>
|
||||
string.Join(str, values.Select(v => v.ToString(format, format_provider)));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user