summaryrefslogtreecommitdiff
path: root/modules/mono/glue/Managed/Files/StringExtensions.cs
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-05 10:29:19 +0200
committerGitHub <noreply@github.com>2019-07-05 10:29:19 +0200
commit6e9cb44004b8bd30a5834d06671ccd1c62508bfe (patch)
treee3086f5a8a133dc0630e6f5e4b7065e174977df3 /modules/mono/glue/Managed/Files/StringExtensions.cs
parenta149e412f75e9eef87e8ff54e21402f90161f65b (diff)
parent0639946c72ba6632bc3b0953d64f644af328e5e6 (diff)
Merge pull request #30282 from neikeq/editor_in_cs_equals_win
Re-write mono module editor code in C#
Diffstat (limited to 'modules/mono/glue/Managed/Files/StringExtensions.cs')
-rw-r--r--modules/mono/glue/Managed/Files/StringExtensions.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/mono/glue/Managed/Files/StringExtensions.cs b/modules/mono/glue/Managed/Files/StringExtensions.cs
index c194facd0b..b43034fbb5 100644
--- a/modules/mono/glue/Managed/Files/StringExtensions.cs
+++ b/modules/mono/glue/Managed/Files/StringExtensions.cs
@@ -299,14 +299,14 @@ namespace Godot
if (basepos != -1)
{
var end = basepos + 3;
- rs = instance.Substring(end, instance.Length);
+ rs = instance.Substring(end);
@base = instance.Substring(0, end);
}
else
{
if (instance.BeginsWith("/"))
{
- rs = instance.Substring(1, instance.Length);
+ rs = instance.Substring(1);
@base = "/";
}
else
@@ -333,7 +333,7 @@ namespace Godot
if (sep == -1)
return instance;
- return instance.Substring(sep + 1, instance.Length);
+ return instance.Substring(sep + 1);
}
// <summary>
@@ -911,7 +911,8 @@ namespace Godot
// </summary>
public static string Substr(this string instance, int from, int len)
{
- return instance.Substring(from, len);
+ int max = instance.Length - from;
+ return instance.Substring(from, len > max ? max : len);
}
// <summary>