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

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

[Octave-bug-tracker] [bug #52488] genvarname substitutes underscore to i


From: Rik
Subject: [Octave-bug-tracker] [bug #52488] genvarname substitutes underscore to invalid characters in string
Date: Thu, 23 Nov 2017 12:19:42 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #52488 (project octave):

                Severity:              3 - Normal => 2 - Minor              
                Priority:              5 - Normal => 1 - Later              
                  Status:                    None => Confirmed              

    _______________________________________________________

Follow-up Comment #1:

According to Matlab's documentation,


varname = genvarname(str) constructs a string or character vector varname that
is similar to or the same as the str input, and can be used as a valid
variable name.


The only requirements are that the name be "similar" and that the name is a
valid syntax for the interpreter.

Although Octave doesn't remove spaces as Matlab does, it does produce a valid
variable name that is "similar" to the original.  It meets the requirements of
the function genvarname, and I prefer the use of underscores as I think it
makes the generated names easier to read.  Imagine you have a variable name
that encodes something about a measurement in the name.


var = 'Site 1 laboratory 5 centrifuge 3 RPM';
genvarname (var)
Octave:
ans = Site_1_laboratory_5_centrifuge_3_RPM
Matlab:
ans = Site1laboratory5centrifuge3RPM


The Matlab name is very difficult to decipher.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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