From 7106905a5b866731be6e6d35ceb5855104c4c634 Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Mon, 28 Nov 2022 18:23:00 +0100 Subject: [PATCH] C#: Deprecate string extensions that will be removed in 4.x - Deprecated `Length` in favor of the `string.Length` property. - Deprecated `Insert` in favor of the existing instance method with the same signature. - Deprecated `Erase` in favor of `StringBuilder.Remove`. - Deprecated `ToLower` and `ToUpper` in favor of the instance methods with the same signature. - Deprecated `BeginsWith` in favor of `string.StartsWith`. - Deprecated `EndsWith` in favor of the instance method with the same signature. - Deprecated `Empty` in favor of `string.IsNullOrEmpty`. - Deprecated `OrdAt` in favor of the `string[int]` indexer. - Deprecated `LStrip` and `RStrip` in favor of `string.TrimStart` and `string.TrimEnd`. --- .../GodotSharp/GodotSharp/Core/StringExtensions.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index 992e2e54431..05aa1aff8ec 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -89,6 +89,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); @@ -405,6 +406,7 @@ namespace Godot /// /// Returns if the string is empty. /// + [Obsolete("Use string.IsNullOrEmpty instead.")] public static bool Empty(this string instance) { return string.IsNullOrEmpty(instance); @@ -417,6 +419,7 @@ namespace Godot /// The string to check. /// The ending string. /// If the string ends with the given string. + [Obsolete("Use string.EndsWith instead.")] public static bool EndsWith(this string instance, string text) { return instance.EndsWith(text); @@ -428,6 +431,7 @@ namespace Godot /// The string to modify. /// Starting position from which to erase. /// Amount of characters to erase. + [Obsolete("Use StringBuilder.Remove instead.")] public static void Erase(this StringBuilder instance, int pos, int chars) { instance.Remove(pos, chars); @@ -740,6 +744,7 @@ namespace Godot /// The string with inserted at the given /// position . /// + [Obsolete("Use string.Insert instead.")] public static string Insert(this string instance, int pos, string what) { return instance.Insert(pos, what); @@ -974,6 +979,7 @@ namespace Godot /// /// The string to check. /// The length of the string. + [Obsolete("Use string.Length property instead.")] public static int Length(this string instance) { return instance.Length; @@ -986,6 +992,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 property instead.")] public static string LStrip(this string instance, string chars) { int len = instance.Length; @@ -1120,6 +1127,7 @@ namespace Godot /// The string to check. /// The position int the string for the character to check. /// The character code. + [Obsolete("Use string[int] indexer instead.")] public static int OrdAt(this string instance, int at) { return instance[at]; @@ -1321,6 +1329,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 property instead.")] public static string RStrip(this string instance, string chars) { int len = instance.Length; @@ -1560,6 +1569,7 @@ namespace Godot /// /// The string to convert. /// The string converted to lowercase. + [Obsolete("Use string.ToLower instead.")] public static string ToLower(this string instance) { return instance.ToLower(); @@ -1571,6 +1581,7 @@ namespace Godot /// /// The string to convert. /// The string converted to uppercase. + [Obsolete("Use string.ToUpper instead.")] public static string ToUpper(this string instance) { return instance.ToUpper();