Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Remove obsolete StringExtensions methods #72182

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,6 @@ private static string GetSliceCharacter(this string instance, char splitter, int
return string.Empty;
}

/// <summary>
/// Returns <see langword="true"/> if the strings begins
/// with the given string <paramref name="text"/>.
/// </summary>
/// <param name="instance">The string to check.</param>
/// <param name="text">The beginning string.</param>
/// <returns>If the string begins with the given string.</returns>
[Obsolete("Use string.StartsWith instead.")]
public static bool BeginsWith(this string instance, string text)
{
return instance.StartsWith(text);
}

/// <summary>
/// Returns the bigrams (pairs of consecutive letters) of this string.
/// </summary>
Expand Down Expand Up @@ -618,7 +605,7 @@ public static string GetBaseDir(this string instance)
}
else
{
if (instance.BeginsWith("/"))
if (instance.StartsWith('/'))
{
rs = instance.Substring(1);
directory = "/";
Expand Down Expand Up @@ -1198,23 +1185,6 @@ public static string Left(this string instance, int pos)
return instance.Substring(0, pos);
}

/// <summary>
/// Returns a copy of the string with characters removed from the left.
/// The <paramref name="chars"/> argument is a string specifying the set of characters
/// to be removed.
/// Note: The <paramref name="chars"/> is not a prefix. See <see cref="TrimPrefix"/>
/// method that will remove a single prefix string rather than a set of characters.
/// </summary>
/// <seealso cref="RStrip(string, string)"/>
/// <param name="instance">The string to remove characters from.</param>
/// <param name="chars">The characters to be removed.</param>
/// <returns>A copy of the string with characters removed from the left.</returns>
[Obsolete("Use string.TrimStart instead.")]
public static string LStrip(this string instance, string chars)
{
return instance.TrimStart(chars.ToCharArray());
}

/// <summary>
/// Do a simple expression match, where '*' matches zero or more
/// arbitrary characters and '?' matches any single character except '.'.
Expand Down Expand Up @@ -1503,23 +1473,6 @@ public static string Right(this string instance, int pos)
return instance.Substring(pos, instance.Length - pos);
}

/// <summary>
/// Returns a copy of the string with characters removed from the right.
/// The <paramref name="chars"/> argument is a string specifying the set of characters
/// to be removed.
/// Note: The <paramref name="chars"/> is not a suffix. See <see cref="TrimSuffix"/>
/// method that will remove a single suffix string rather than a set of characters.
/// </summary>
/// <seealso cref="LStrip(string, string)"/>
/// <param name="instance">The string to remove characters from.</param>
/// <param name="chars">The characters to be removed.</param>
/// <returns>A copy of the string with characters removed from the right.</returns>
[Obsolete("Use string.TrimEnd instead.")]
public static string RStrip(this string instance, string chars)
{
return instance.TrimEnd(chars.ToCharArray());
}

/// <summary>
/// Returns the SHA-1 hash of the string as an array of bytes.
/// </summary>
Expand Down