changeset 25621:0fa7312e34bc

Accept case insensitive second argument to typecast for Matlab compatibility (bug #54313). * typecast.cc (Ftypecast): #include <algorithm> for access to std::transform. Call std::transform with tolower in order to lowercase second argument.
author Rik <rik@octave.org>
date Sat, 14 Jul 2018 22:48:02 -0700
parents 467729037209
children a7ee69d23f32
files libinterp/corefcn/typecast.cc
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/typecast.cc	Sat Jul 14 14:16:22 2018 +0200
+++ b/libinterp/corefcn/typecast.cc	Sat Jul 14 22:48:02 2018 -0700
@@ -25,6 +25,7 @@
 #  include "config.h"
 #endif
 
+#include <algorithm>
 #include <limits>
 
 #include "mx-base.h"
@@ -227,6 +228,8 @@
            array.class_name ().c_str ());
 
   std::string numclass = args(1).string_value ();
+  std::transform (numclass.begin (), numclass.end (), numclass.begin (),
+                  tolower);
 
   if (numclass.size () == 0)
     ;