From dc2ceef0ecb35210dc9419dbb4d0e22c4fe1cad7 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Sun, 27 Nov 2022 23:25:48 +0100 Subject: C#: Remove/deprecate unnecessary string extensions - Removed `UnicodeAt` - Removed `EndsWith` - Removed `LPad` and `RPad` - Deprecated `BeginsWith` in favor of `string.StartsWith` - Deprecated `LStrip` and `RStrip` in favor of `string.TrimStart` and `string.TrimEnd` --- .../GodotSharp/GodotSharp/Core/StringExtensions.cs | 52 ++-------------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index dd399fb24b..d4329d78c1 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -75,6 +75,7 @@ namespace Godot /// The string to check. /// The beginning string. /// If the string begins with the given string. + [Obsolete("Use string.StartsWith instead.")] public static bool BeginsWith(this string instance, string text) { return instance.StartsWith(text); @@ -502,18 +503,6 @@ namespace Godot } } - /// - /// Returns if the strings ends - /// with the given string . - /// - /// The string to check. - /// The ending string. - /// If the string ends with the given string. - public static bool EndsWith(this string instance, string text) - { - return instance.EndsWith(text); - } - /// /// Returns the extension without the leading period character (.) /// if the string is a valid file name or path. If the string does not contain @@ -1209,19 +1198,6 @@ namespace Godot return instance.Substring(0, pos); } - /// - /// Formats a string to be at least long by - /// adding s to the left of the string. - /// - /// String that will be padded. - /// Minimum length that the resulting string must have. - /// Character to add to the left of the string. - /// String padded with the specified character. - public static string LPad(this string instance, int minLength, char character = ' ') - { - return instance.PadLeft(minLength, character); - } - /// /// Returns a copy of the string with characters removed from the left. /// The argument is a string specifying the set of characters @@ -1233,6 +1209,7 @@ namespace Godot /// The string to remove characters from. /// The characters to be removed. /// A copy of the string with characters removed from the left. + [Obsolete("Use string.TrimStart instead.")] public static string LStrip(this string instance, string chars) { return instance.TrimStart(chars.ToCharArray()); @@ -1526,19 +1503,6 @@ namespace Godot return instance.Substring(pos, instance.Length - pos); } - /// - /// Formats a string to be at least long by - /// adding s to the right of the string. - /// - /// String that will be padded. - /// Minimum length that the resulting string must have. - /// Character to add to the right of the string. - /// String padded with the specified character. - public static string RPad(this string instance, int minLength, char character = ' ') - { - return instance.PadRight(minLength, character); - } - /// /// Returns a copy of the string with characters removed from the right. /// The argument is a string specifying the set of characters @@ -1550,6 +1514,7 @@ namespace Godot /// The string to remove characters from. /// The characters to be removed. /// A copy of the string with characters removed from the right. + [Obsolete("Use string.TrimEnd instead.")] public static string RStrip(this string instance, string chars) { return instance.TrimEnd(chars.ToCharArray()); @@ -1885,17 +1850,6 @@ namespace Godot return instance; } - /// - /// Returns the character code at position . - /// - /// The string to check. - /// The position int the string for the character to check. - /// The character code. - public static int UnicodeAt(this string instance, int at) - { - return instance[at]; - } - /// /// Decodes a string in URL encoded format. This is meant to /// decode parameters in a URL when receiving an HTTP request. -- cgit v1.2.3