How to call string methods using Reflect?

I am trying this out to use it on string values. But no luck. It returns false. So I cannot use the string method using Reflect.field

trace(Reflect.hasField(Std.string("ABCDE"),"toLowerCase"));

How can I use Reflect.field to use a function passed in the form of string to be used on an instance of string?

Any ideas?

        var o:String = "ASD";
        trace(Reflect.callMethod(o, Reflect.field(o, "toLowerCase"), []));

https://try.haxe.org/#36937

1 Like