24 #if defined (HAVE_CONFIG_H)
44 #define ORD(ch) static_cast<unsigned char>(ch)
45 #define TABSIZE (std::numeric_limits<unsigned char>::max () + 1)
53 const char *
x = needle.
data ();
59 table[
ORD(x[
i])] = m -
i;
68 const char *
x = needle.
data ();
70 const char *
y = haystack.
data ();
75 std::deque<octave_idx_type> accum;
92 if (y[
i] == x[0] && y[
i+1] == x[1])
100 if (y[
i] == x[0] && y[
i+1] == x[1])
101 accum.push_back (
i++);
114 if (std::equal (x, x + m, y + j))
116 j += table[
ORD(y[j + m])];
123 if (std::equal (x, x + m, y + j))
129 j += table[
ORD(y[j + m])];
133 if (j == n - m && std::equal (x, x + m, y + j))
141 for (std::deque<octave_idx_type>::const_iterator iter = accum.begin ();
142 iter != accum.end (); iter++)
144 result.
xelem (k++) = *iter;
196 if (nargin != 4 && nargin != 2)
199 bool overlaps =
true;
203 error (
"strfind: invalid optional arguments");
207 if (opt ==
"overlaps")
208 overlaps =
args(3).bool_value ();
210 error (
"strfind: unknown option: %s", opt.c_str ());
243 error (
"strfind: each element of CELLSTR must be a string");
257 error (
"strfind: first argument must be a string or cell array of strings");
262 error (
"strfind: PATTERN must be a string or cell array of strings");
288 bool overlaps =
true)
324 retsiz = siz + nidx * (rsiz - psiz);
331 const char *src = str.
data ();
332 const char *reps = rep.
data ();
340 dest = std::copy (src + k, src + j, dest);
341 dest = std::copy (reps, reps + rsiz, dest);
345 std::copy (src + k, src + siz, dest);
382 if (nargin != 3 && nargin != 5)
385 bool overlaps =
true;
390 error (
"strrep: invalid optional arguments");
393 if (opt ==
"overlaps")
394 overlaps =
args(4).bool_value ();
396 error (
"strrep: unknown option: %s", opt.c_str ());
429 error (
"strrep: each element of S must be a string");
435 error (
"strrep: S must be a string or cell array of strings");
440 error (
"strrep: PTN and REP arguments must be strings or cell arrays of strings");
charNDArray char_array_value(bool frc_str_conv=false) const
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
bool is_scalar_type(void) const
static Array< octave_idx_type > qs_search(const Array< char > &needle, const Array< char > &haystack, const octave_idx_type *table, bool overlaps=true)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
OCTAVE_EXPORT octave_value_list Fstrfind(const octave_value_list &args, int) or if ar
Cell cell_value(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
nd deftypefn *octave_map m
bool is_string(void) const
const T * data(void) const
With real return the complex result
T & xelem(octave_idx_type n)
bool is_empty(void) const
=val(i)}if ode{val(i)}occurs in table i
OCTINTERP_API octave_value_list do_simple_cellfun(octave_value_list(*fun)(const octave_value_list &, int), const char *fun_name, const octave_value_list &args, int nargout)
the element is set to zero In other the statement xample y
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
static void qs_preprocess(const Array< char > &needle, octave_idx_type *table)
const T * fortran_vec(void) const
Vector representing the dimensions (size) of an Array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
OCTINTERP_API octave_value_list Fstrrep(const octave_value_list &=octave_value_list(), int=0)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
charNDArray min(char d, const charNDArray &m)