Closed
Description
Tested versions
Found in version 4.4.1
Reproducible in version 4.2.2 and 4.5 beta 1
System information
Windows 11 - Godot Engine v4.4.1.stable.mono.official - Intel Core i7 14th Gen - Nvidia Geforce RTX 3050
Issue description
When calling GetExtension() on a string in a C# script if the string doesn't have an extension the full string will be returned instead of an empty string. When called on a string with no file extension at the end an empty string should be returned instead.
Steps to reproduce
- Create a new C# project
- Create a C# script
- Add a string variable with no file extension
- Call GetExtension() on the string
using Godot;
using System;
public partial class new_script : Node {
public override void _Ready() {
// Returns jpg
string test1 = "test.jpg";
GD.Print("test 1 ", test1.GetExtension());
// Returns test
string test2 = "test";
GD.Print("test 2 ", test2.GetExtension());
}
}
extends Node
func _ready():
# Returns jpg
var test1 = "test.jpg"
print("test 1 ", test1.get_extension())
# Returns empty string
var test2 = "test"
print("test 2 ", test2.get_extension())
Minimal reproduction project (MRP)
N/A