octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #33537] lower function returns incorect result


From: Rik
Subject: [Octave-bug-tracker] [bug #33537] lower function returns incorect result on numerical values
Date: Sun, 17 Jul 2011 04:35:36 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0

Follow-up Comment #8, bug #33537 (project octave):

How does the following attempt look to everyone?  I made the change in
mappers.cc at the DEFUN for toupper rather than at the mapping function
itself.  It appears to work and gives an error if the input is not a string or
cell array of strings.


DEFUNX ("toupper", Ftoupper, args, ,
    "-*- texinfo -*-n
@deftypefn  {Mapping Function} {} toupper (@var{s})n
@deftypefnx {Mapping Function} {} upper (@var{s})n
Return a copy of the string or cell string @var{s}, with each lowercasen
character replaced by the corresponding uppercase one; non-alphabeticn
characters are left unchanged.  For example:n
n
@examplen
@groupn
toupper ("MiXeD cAsE 123")n
     @result{} "MIXED CASE 123"n
@end groupn
@end examplen
@seealso{tolower}n
@end deftypefn")
{
  octave_value retval;

  if (args.length () != 1 || ! (args(0).is_string () || args(0).is_cellstr
()))
    print_usage ();
  else
    retval = args(0).xtoupper ();

  return retval;
}


The old code was


  if (args.length () == 1)
    retval = args(0).xtolower ();
  else
    print_usage ();



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?33537>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]