fabien van mook

all packages "fvm-*"

package "fvm-charvec"

file "attention.txt"

note when string entities are introduced into octave: 

-- 'foo' (sq) will remain a 3-element character row vector
   "foo" (dq) will be a     1-element string entity
   
-- advice: change all dq into sq

-- in matlab we have:
   -- special escapes "\n" etc (also as '\n' etc.) in the template
      are interpreted by sprintf() and compose()
   -- sprintf(t,...) returns a character vector if template t is 
      a character vector !
   -- compose() returns a single string entity or a string array, or
      a cell-array of character vectors, depending on the template
   -- string arrays are indexed by (...), and not by {...} !
   
-- possible problems for my scripts:
   -- mainly dq are used
   -- constructs like ["a" cv "b"] or ['a' cv 'b'] with character vector cv
      -- what will happen if cv happens to be a modern string entity?
      -- in actual matlab [seq 'ATTAGAAACC'] returns a
         character vector (if seq is a character vector) 
   -- what renewed functions, sprintf() etc., will output? modern string entities?
      -- if sprintf(), strjoin(), strsplit() etc will return string entities 
         or string matrices, one could replace the calls to these functions 
         by sprintf_charvec(), strjoin_charvec(), strsplit_charvec() etc., 
         which return (cell-arrays of) character vectors.
      -- see below for excerpts form the actual matlab manual
   -- what will be the behaviour of ischar() and isstring() ?

--------

undo_string_escapes() and undo_string_escapes() belong to Octave.
(--> what will happen to them when string arrays have been introduced in Octave ?)

--------

Text in String and Character Arrays
https://nl.mathworks.com/help/matlab/matlab_prog/represent-text-with-character-and-string-arrays.html

--> Represent Text with Character Vectors
    ... For example, you can store a DNA sequence as a
    character vector.
      seq = 'GCTAGAATCC';
    You can access individual characters or subsets of
    characters by indexing, just as you would index into a
    numeric array.
      seq(4:6)
    => ans =
     'AGA'
    Concatenate character vector with square brackets, just
    as you concatenate other types of arrays.
      seq2 = [seq 'ATTAGAAACC']
    => seq2 =
     'GCTAGAATCCATTAGAAACC'

--------

Update Your Code to Accept Strings
https://nl.mathworks.com/help/matlab/matlab_prog/update-your-code-to-accept-strings.html

--------

https://nl.mathworks.com/help/matlab/ref/convertstringstochars.html

B = convertStringsToChars(A) converts A to a character
vector or a cell array of character vectors if A is a string
array. Otherwise, convertStringsToChars returns A unaltered.

[B1,...,Bn] = convertStringsToChars(A1,...,An) converts any
string arrays in A1,...,An to character vectors or cell
arrays of character vectors, and then returns them as the
corresponding output arguments in B1,...,Bn. If any of the
arguments A1,...,An has any other data type, then
convertStringsToChars returns it unaltered.

--------

https://nl.mathworks.com/help/matlab/ref/sprintf.html

str = sprintf(formatSpec,A1,...,An)
... If formatSpec is a string, then so is the output str.
Otherwise, str is a character vector. To return multiple
pieces of formatted text as a string array or a cell array
of character vectors, use the compose function.

...

str = sprintf(literalText) translates escape-character
sequences in literalText, such as \n and \t. It returns all
other characters unaltered. If literalText contain a
formatting operator (such as %f), then str discards it and
all characters after.

--------

https://nl.mathworks.com/help/matlab/ref/compose.html

str = compose(formatSpec,A)
... If formatSpec is a string array, then so is the output
array str. Otherwise, str is a cell array of character
vectors.

compose also translates the escape-character sequences in
formatSpec. Escape-character sequences represent nonprinting
characters or specify actions such as newlines or tabs.

The compose function can return multiple pieces of
formatted text as a string array or a cell array of
character vectors, unlike sprintf. The sprintf function
returns only a string scalar or a character vector.

...

str = compose(txt) translates escape-character sequences in txt.

--------

https://nl.mathworks.com/help/matlab/ref/string.html

str = string(A) converts the input array to a string array.
For instance, if A is numeric vector [1 20 300], str is a
string array of the same size, ["1" "20" "300"].

...

--------

https://nl.mathworks.com/help/matlab/ref/strlength.html

L = strlength(str) returns the number of characters in str.

(-- if str is a string array, L is a numerical array; same for cell-arrays of character vectors ! --)

...

strlength counts the number of code units in text. Code
units are bit sequences for encoding characters of a
character encoding system. In some character encodings, such
as UTF-16, there are some characters that are encoded with
multiple code units.

If you have a string or a character vector that contains
such characters, then the number of code units is greater
than the number of characters.

length(C) also returns the number of code units when C is a
character vector.

--------

https://nl.mathworks.com/help/matlab/ref/char.html

C = char(A) converts the input array, A, to a character
array. For instance, if A is a string, "foo", c is a
character array, 'foo'.

--------