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

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

[Octave-bug-tracker] [bug #59532] string concatenation lacks some syntax


From: Hartmut
Subject: [Octave-bug-tracker] [bug #59532] string concatenation lacks some syntax variants of Matlab
Date: Tue, 24 Nov 2020 12:17:16 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0

URL:
  <https://savannah.gnu.org/bugs/?59532>

                 Summary: string concatenation lacks some syntax variants of
Matlab
                 Project: GNU Octave
            Submitted by: hardy
            Submitted on: Tue 24 Nov 2020 05:17:14 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

Here are two "new" ways to concatenate strings. Both do work in Matlab (tested
with R2019b) but do not work currently in Octave (tested with version 5.2.0):


>> mystring = "asdf" + 1.234

mystring =

    "asdf1.234"


(Here the result in Octave is just "different", it is an array of 4 doubles. 
Why not 5 by the way?)


>> mystring2 = ["asdf", 1.234]

mystring2 =

  1×2 string array

    "asdf"    "1.234"


(This just returns the first string "asdf" in Octave and skips the second
part.)

I kind of like especially the first new syntax, because it makes the following
code possible:

  a=5*6; 
  disp("The result is:" + a);

This will probably look familiar to people using Python. 

Maybe we should add those syntax variants to Octave as well?




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59532>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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