annotate doc/interpreter/strings.txi @ 19627:446c46af4b42 stable

strip trailing whitespace from most source files * Makefile.am, NEWS, build-aux/common.mk, configure.ac, doc/Makefile.am, doc/doxyhtml/Makefile.am, doc/interpreter/Makefile.am, doc/interpreter/arith.txi, doc/interpreter/audio.txi, doc/interpreter/basics.txi, doc/interpreter/bugs.txi, doc/interpreter/container.txi, doc/interpreter/cp-idx.txi, doc/interpreter/data.txi, doc/interpreter/debug.txi, doc/interpreter/diagperm.txi, doc/interpreter/diffeq.txi, doc/interpreter/doccheck/README, doc/interpreter/doccheck/spellcheck, doc/interpreter/emacs.txi, doc/interpreter/errors.txi, doc/interpreter/eval.txi, doc/interpreter/expr.txi, doc/interpreter/external.txi, doc/interpreter/fn-idx.txi, doc/interpreter/func.txi, doc/interpreter/geometry.txi, doc/interpreter/geometryimages.m, doc/interpreter/gpl.txi, doc/interpreter/grammar.txi, doc/interpreter/gui.txi, doc/interpreter/image.txi, doc/interpreter/install.txi, doc/interpreter/interp.txi, doc/interpreter/interpimages.m, doc/interpreter/intro.txi, doc/interpreter/io.txi, doc/interpreter/java.txi, doc/interpreter/linalg.txi, doc/interpreter/macros.texi, doc/interpreter/matrix.txi, doc/interpreter/munge-texi.pl, doc/interpreter/nonlin.txi, doc/interpreter/numbers.txi, doc/interpreter/obsolete.txi, doc/interpreter/octave-config.1, doc/interpreter/octave.texi, doc/interpreter/oop.txi, doc/interpreter/op-idx.txi, doc/interpreter/optim.txi, doc/interpreter/package.txi, doc/interpreter/plot.txi, doc/interpreter/poly.txi, doc/interpreter/preface.txi, doc/interpreter/quad.txi, doc/interpreter/set.txi, doc/interpreter/signal.txi, doc/interpreter/sparse.txi, doc/interpreter/sparseimages.m, doc/interpreter/splineimages.m, doc/interpreter/stats.txi, doc/interpreter/stmt.txi, doc/interpreter/strings.txi, doc/interpreter/system.txi, doc/interpreter/testfun.txi, doc/interpreter/tips.txi, doc/interpreter/var.txi, doc/interpreter/vectorize.txi, doc/liboctave/Makefile.am, doc/liboctave/array.texi, doc/liboctave/bugs.texi, doc/liboctave/cp-idx.texi, doc/liboctave/dae.texi, doc/liboctave/diffeq.texi, doc/liboctave/error.texi, doc/liboctave/factor.texi, doc/liboctave/fn-idx.texi, doc/liboctave/gpl.texi, doc/liboctave/install.texi, doc/liboctave/intro.texi, doc/liboctave/liboctave.texi, doc/liboctave/matvec.texi, doc/liboctave/nleqn.texi, doc/liboctave/nlfunc.texi, doc/liboctave/ode.texi, doc/liboctave/optim.texi, doc/liboctave/preface.texi, doc/liboctave/quad.texi, doc/liboctave/range.texi, doc/refcard/Makefile.am, doc/refcard/refcard.tex, etc/HACKING, etc/NEWS.1, etc/NEWS.2, etc/NEWS.3, etc/OLD-ChangeLogs/ChangeLog, etc/OLD-ChangeLogs/doc-ChangeLog, etc/OLD-ChangeLogs/scripts-ChangeLog, etc/OLD-ChangeLogs/src-ChangeLog, etc/OLD-ChangeLogs/test-ChangeLog, etc/PROJECTS, etc/README.Cygwin, etc/README.MacOS, etc/README.MinGW, etc/README.gnuplot, etc/gdbinit, etc/icons/Makefile.am, examples/@polynomial/end.m, examples/@polynomial/subsasgn.m, examples/Makefile.am, examples/standalonebuiltin.cc, libgui/Makefile.am, libgui/qterminal/libqterminal/README, libgui/qterminal/libqterminal/unix/BlockArray.cpp, libgui/qterminal/libqterminal/unix/BlockArray.h, libgui/qterminal/libqterminal/unix/Character.h, libgui/qterminal/libqterminal/unix/CharacterColor.h, libgui/qterminal/libqterminal/unix/Emulation.cpp, libgui/qterminal/libqterminal/unix/Emulation.h, libgui/qterminal/libqterminal/unix/Filter.cpp, libgui/qterminal/libqterminal/unix/Filter.h, libgui/qterminal/libqterminal/unix/History.cpp, libgui/qterminal/libqterminal/unix/History.h, libgui/qterminal/libqterminal/unix/KeyboardTranslator.cpp, libgui/qterminal/libqterminal/unix/KeyboardTranslator.h, libgui/qterminal/libqterminal/unix/LineFont.h, libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.cpp, libgui/qterminal/libqterminal/unix/QUnixTerminalImpl.h, libgui/qterminal/libqterminal/unix/Screen.cpp, libgui/qterminal/libqterminal/unix/Screen.h, libgui/qterminal/libqterminal/unix/ScreenWindow.cpp, libgui/qterminal/libqterminal/unix/ScreenWindow.h, libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.cpp, libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.h, libgui/qterminal/libqterminal/unix/Vt102Emulation.h, libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp, libgui/qterminal/qterminal/main.cpp, libgui/src/m-editor/file-editor-tab.cc, libgui/src/octave-gui.cc, libgui/src/octave-qt-link.cc, libinterp/corefcn/data.cc, libinterp/corefcn/defun-int.h, libinterp/corefcn/det.cc, libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/oct-tex-parser.yy, libinterp/corefcn/oct-tex-symbols.in, libinterp/corefcn/quadcc.cc, libinterp/corefcn/zfstream.cc, libinterp/dldfcn/__eigs__.cc, libinterp/dldfcn/__voronoi__.cc, libinterp/gendoc.pl, libinterp/genprops.awk, libinterp/mk-errno-list, libinterp/mk-pkg-add, libinterp/mkbuiltins, libinterp/mkdefs, libinterp/mkdocs, libinterp/mkops, libinterp/octave-value/ov-java.cc, libinterp/parse-tree/lex.ll, libinterp/parse-tree/oct-parse.in.yy, libinterp/parse-tree/octave.gperf, liboctave/Makefile.am, liboctave/array/Array.cc, liboctave/array/module.mk, liboctave/cruft/daspk/datv.f, liboctave/cruft/daspk/dcnst0.f, liboctave/cruft/daspk/dcnstr.f, liboctave/cruft/daspk/ddasic.f, liboctave/cruft/daspk/ddasid.f, liboctave/cruft/daspk/ddasik.f, liboctave/cruft/daspk/ddaspk.f, liboctave/cruft/daspk/ddstp.f, liboctave/cruft/daspk/ddwnrm.f, liboctave/cruft/daspk/dfnrmd.f, liboctave/cruft/daspk/dfnrmk.f, liboctave/cruft/daspk/dhels.f, liboctave/cruft/daspk/dheqr.f, liboctave/cruft/daspk/dinvwt.f, liboctave/cruft/daspk/dlinsd.f, liboctave/cruft/daspk/dlinsk.f, liboctave/cruft/daspk/dmatd.f, liboctave/cruft/daspk/dnedd.f, liboctave/cruft/daspk/dnedk.f, liboctave/cruft/daspk/dnsd.f, liboctave/cruft/daspk/dnsid.f, liboctave/cruft/daspk/dnsik.f, liboctave/cruft/daspk/dnsk.f, liboctave/cruft/daspk/dorth.f, liboctave/cruft/daspk/dslvd.f, liboctave/cruft/daspk/dslvk.f, liboctave/cruft/daspk/dspigm.f, liboctave/cruft/daspk/dyypnw.f, liboctave/cruft/dasrt/ddasrt.f, liboctave/cruft/dasrt/drchek.f, liboctave/cruft/dassl/ddaslv.f, liboctave/cruft/dassl/ddassl.f, liboctave/cruft/misc/blaswrap.c, liboctave/cruft/misc/module.mk, liboctave/cruft/odepack/cfode.f, liboctave/cruft/odepack/dlsode.f, liboctave/cruft/odepack/ewset.f, liboctave/cruft/odepack/intdy.f, liboctave/cruft/odepack/prepj.f, liboctave/cruft/odepack/sintdy.f, liboctave/cruft/odepack/slsode.f, liboctave/cruft/odepack/solsy.f, liboctave/cruft/odepack/ssolsy.f, liboctave/cruft/odepack/stode.f, liboctave/cruft/odepack/vnorm.f, liboctave/cruft/ranlib/Basegen.doc, liboctave/cruft/ranlib/README, liboctave/cruft/ranlib/genbet.f, liboctave/cruft/ranlib/genexp.f, liboctave/cruft/ranlib/gennch.f, liboctave/cruft/ranlib/gennf.f, liboctave/cruft/ranlib/gennor.f, liboctave/cruft/ranlib/getsd.f, liboctave/cruft/ranlib/initgn.f, liboctave/cruft/ranlib/phrtsd.f, liboctave/cruft/ranlib/randlib.fdoc, liboctave/cruft/ranlib/setsd.f, liboctave/cruft/ranlib/tstgmn.for, liboctave/cruft/ranlib/tstmid.for, liboctave/cruft/slatec-fn/atanh.f, liboctave/cruft/slatec-fn/datanh.f, liboctave/cruft/slatec-fn/xgmainc.f, liboctave/cruft/slatec-fn/xsgmainc.f, liboctave/numeric/module.mk, liboctave/operators/mk-ops.awk, liboctave/operators/mx-ops, liboctave/operators/sparse-mk-ops.awk, liboctave/operators/sparse-mx-ops, liboctave/operators/vx-ops, liboctave/util/module.mk, run-octave.in, scripts/@ftp/ftp.m, scripts/audio/wavread.m, scripts/deprecated/java_convert_matrix.m, scripts/deprecated/java_debug.m, scripts/deprecated/java_invoke.m, scripts/deprecated/java_new.m, scripts/deprecated/java_unsigned_conversion.m, scripts/deprecated/javafields.m, scripts/deprecated/javamethods.m, scripts/deprecated/shell_cmd.m, scripts/general/accumarray.m, scripts/general/display.m, scripts/general/fieldnames.m, scripts/general/interp1.m, scripts/general/interp2.m, scripts/general/interp3.m, scripts/general/isa.m, scripts/general/methods.m, scripts/general/sortrows.m, scripts/geometry/convhull.m, scripts/geometry/delaunay.m, scripts/geometry/delaunay3.m, scripts/geometry/delaunayn.m, scripts/geometry/griddata.m, scripts/geometry/griddatan.m, scripts/geometry/voronoi.m, scripts/geometry/voronoin.m, scripts/gui/guihandles.m, scripts/gui/inputdlg.m, scripts/gui/listdlg.m, scripts/gui/msgbox.m, scripts/gui/questdlg.m, scripts/gui/uigetfile.m, scripts/gui/waitbar.m, scripts/gui/warndlg.m, scripts/help/doc.m, scripts/help/help.m, scripts/help/type.m, scripts/image/bone.m, scripts/image/cmpermute.m, scripts/image/cmunique.m, scripts/image/colorcube.m, scripts/image/colormap.m, scripts/image/contrast.m, scripts/image/gray2ind.m, scripts/image/image.m, scripts/image/imshow.m, scripts/image/ind2gray.m, scripts/image/jet.m, scripts/image/rgb2ntsc.m, scripts/image/spinmap.m, scripts/io/importdata.m, scripts/io/strread.m, scripts/io/textread.m, scripts/io/textscan.m, scripts/java/java_get.m, scripts/java/java_set.m, scripts/java/javaaddpath.m, scripts/java/javaclasspath.m, scripts/java/javamem.m, scripts/linear-algebra/linsolve.m, scripts/linear-algebra/qzhess.m, scripts/miscellaneous/debug.m, scripts/miscellaneous/desktop.m, scripts/miscellaneous/dir.m, scripts/miscellaneous/dos.m, scripts/miscellaneous/edit.m, scripts/miscellaneous/fact.m, scripts/miscellaneous/getappdata.m, scripts/miscellaneous/inputname.m, scripts/miscellaneous/license.m, scripts/miscellaneous/ls_command.m, scripts/miscellaneous/run.m, scripts/miscellaneous/setfield.m, scripts/miscellaneous/unix.m, scripts/miscellaneous/ver.m, scripts/mk-pkg-add, scripts/mkdoc.pl, scripts/optimization/fminsearch.m, scripts/optimization/optimset.m, scripts/optimization/sqp.m, scripts/pkg/pkg.m, scripts/pkg/private/create_pkgadddel.m, scripts/pkg/private/fix_depends.m, scripts/pkg/private/install.m, scripts/plot/appearance/axis.m, scripts/plot/appearance/box.m, scripts/plot/appearance/clabel.m, scripts/plot/appearance/daspect.m, scripts/plot/appearance/datetick.m, scripts/plot/appearance/grid.m, scripts/plot/appearance/legend.m, scripts/plot/appearance/orient.m, scripts/plot/appearance/shading.m, scripts/plot/appearance/text.m, scripts/plot/appearance/title.m, scripts/plot/appearance/xlabel.m, scripts/plot/appearance/ylabel.m, scripts/plot/appearance/zlabel.m, scripts/plot/draw/area.m, scripts/plot/draw/bar.m, scripts/plot/draw/barh.m, scripts/plot/draw/colorbar.m, scripts/plot/draw/contour.m, scripts/plot/draw/contour3.m, scripts/plot/draw/contourf.m, scripts/plot/draw/ellipsoid.m, scripts/plot/draw/errorbar.m, scripts/plot/draw/ezcontour.m, scripts/plot/draw/ezcontourf.m, scripts/plot/draw/ezmesh.m, scripts/plot/draw/ezpolar.m, scripts/plot/draw/fill.m, scripts/plot/draw/fplot.m, scripts/plot/draw/hist.m, scripts/plot/draw/meshc.m, scripts/plot/draw/meshz.m, scripts/plot/draw/pareto.m, scripts/plot/draw/patch.m, scripts/plot/draw/peaks.m, scripts/plot/draw/pie.m, scripts/plot/draw/pie3.m, scripts/plot/draw/plot.m, scripts/plot/draw/plotyy.m, scripts/plot/draw/private/__bar__.m, scripts/plot/draw/private/__contour__.m, scripts/plot/draw/private/__errplot__.m, scripts/plot/draw/private/__ezplot__.m, scripts/plot/draw/private/__patch__.m, scripts/plot/draw/private/__stem__.m, scripts/plot/draw/rectangle.m, scripts/plot/draw/ribbon.m, scripts/plot/draw/rose.m, scripts/plot/draw/scatter.m, scripts/plot/draw/scatter3.m, scripts/plot/draw/semilogx.m, scripts/plot/draw/shrinkfaces.m, scripts/plot/draw/sombrero.m, scripts/plot/draw/sphere.m, scripts/plot/draw/stairs.m, scripts/plot/draw/stem.m, scripts/plot/draw/stemleaf.m, scripts/plot/draw/surf.m, scripts/plot/draw/surface.m, scripts/plot/draw/surfc.m, scripts/plot/draw/surfl.m, scripts/plot/draw/surfnorm.m, scripts/plot/draw/tetramesh.m, scripts/plot/draw/trimesh.m, scripts/plot/draw/triplot.m, scripts/plot/draw/trisurf.m, scripts/plot/util/__gnuplot_drawnow__.m, scripts/plot/util/__plt_get_axis_arg__.m, scripts/plot/util/axes.m, scripts/plot/util/clf.m, scripts/plot/util/copyobj.m, scripts/plot/util/figure.m, scripts/plot/util/gcbo.m, scripts/plot/util/graphics_toolkit.m, scripts/plot/util/hggroup.m, scripts/plot/util/meshgrid.m, scripts/plot/util/newplot.m, scripts/plot/util/print.m, scripts/plot/util/private/__add_default_menu__.m, scripts/plot/util/private/__fltk_print__.m, scripts/plot/util/private/__gnuplot_print__.m, scripts/plot/util/private/__print_parse_opts__.m, scripts/plot/util/refreshdata.m, scripts/plot/util/subplot.m, scripts/polynomial/conv.m, scripts/polynomial/poly.m, scripts/polynomial/polyeig.m, scripts/polynomial/polyfit.m, scripts/polynomial/polyval.m, scripts/polynomial/private/__splinefit__.m, scripts/polynomial/spline.m, scripts/prefs/prefdir.m, scripts/prefs/preferences.m, scripts/prefs/private/prefsfile.m, scripts/prefs/rmpref.m, scripts/signal/freqz.m, scripts/signal/module.mk, scripts/sparse/eigs.m, scripts/sparse/pcg.m, scripts/sparse/private/__sprand_impl__.m, scripts/sparse/sprand.m, scripts/sparse/sprandn.m, scripts/sparse/spy.m, scripts/sparse/svds.m, scripts/specfun/expint.m, scripts/specfun/factor.m, scripts/special-matrix/gallery.m, scripts/special-matrix/hankel.m, scripts/special-matrix/toeplitz.m, scripts/startup/inputrc, scripts/statistics/base/kurtosis.m, scripts/statistics/base/moment.m, scripts/statistics/base/qqplot.m, scripts/statistics/base/var.m, scripts/statistics/distributions/betarnd.m, scripts/statistics/distributions/binoinv.m, scripts/statistics/distributions/binopdf.m, scripts/statistics/distributions/binornd.m, scripts/statistics/distributions/cauchy_rnd.m, scripts/statistics/distributions/chi2rnd.m, scripts/statistics/distributions/discrete_pdf.m, scripts/statistics/distributions/discrete_rnd.m, scripts/statistics/distributions/empirical_rnd.m, scripts/statistics/distributions/exprnd.m, scripts/statistics/distributions/frnd.m, scripts/statistics/distributions/gamrnd.m, scripts/statistics/distributions/geornd.m, scripts/statistics/distributions/hygernd.m, scripts/statistics/distributions/kolmogorov_smirnov_cdf.m, scripts/statistics/distributions/laplace_cdf.m, scripts/statistics/distributions/laplace_pdf.m, scripts/statistics/distributions/logistic_cdf.m, scripts/statistics/distributions/logistic_pdf.m, scripts/statistics/distributions/lognrnd.m, scripts/statistics/distributions/nbincdf.m, scripts/statistics/distributions/nbininv.m, scripts/statistics/distributions/nbinpdf.m, scripts/statistics/distributions/nbinrnd.m, scripts/statistics/distributions/normrnd.m, scripts/statistics/distributions/poissinv.m, scripts/statistics/distributions/poissrnd.m, scripts/statistics/distributions/tinv.m, scripts/statistics/distributions/trnd.m, scripts/statistics/distributions/unidcdf.m, scripts/statistics/distributions/unidpdf.m, scripts/statistics/distributions/unidrnd.m, scripts/statistics/distributions/unifrnd.m, scripts/statistics/distributions/wblrnd.m, scripts/statistics/models/module.mk, scripts/statistics/tests/kruskal_wallis_test.m, scripts/strings/base2dec.m, scripts/strings/deblank.m, scripts/strings/dec2base.m, scripts/strings/dec2bin.m, scripts/strings/dec2hex.m, scripts/strings/mat2str.m, scripts/strings/ostrsplit.m, scripts/strings/regexptranslate.m, scripts/strings/str2num.m, scripts/strings/strcat.m, scripts/strings/strjoin.m, scripts/strings/strsplit.m, scripts/strings/strtok.m, scripts/strings/strtrim.m, scripts/strings/strtrunc.m, scripts/strings/substr.m, scripts/testfun/__run_test_suite__.m, scripts/testfun/speed.m, scripts/testfun/test.m, scripts/time/asctime.m, scripts/time/datenum.m, scripts/time/datevec.m, scripts/time/weekday.m, src/Makefile.am, test/Makefile.am, test/build-bc-overload-tests.sh, test/build-sparse-tests.sh, test/jit.tst, test/line-continue.tst: Strip trailing whitespace.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 08:26:57 -0500
parents d63878346099
children 0e1f5a750d00
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17281
diff changeset
1 @c Copyright (C) 1996-2013 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
4 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
8 @c your option) any later version.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
9 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
13 @c for more details.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
14 @c
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 7001
diff changeset
17 @c <http://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
18
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3920
diff changeset
19 @node Strings
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
20 @chapter Strings
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21 @cindex strings
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
22 @cindex character strings
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
23 @opindex "
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
24 @opindex '
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
25
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
26 A @dfn{string constant} consists of a sequence of characters enclosed in
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
27 either double-quote or single-quote marks. For example, both of the
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
28 following expressions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
29
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
30 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
31 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
32 "parrot"
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
33 'parrot'
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
34 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
35 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
36
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
37 @noindent
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
38 represent the string whose contents are @samp{parrot}. Strings in
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
39 Octave can be of any length.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
40
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
41 Since the single-quote mark is also used for the transpose operator
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
42 (@pxref{Arithmetic Ops}) but double-quote marks have no other purpose in Octave,
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
43 it is best to use double-quote marks to denote strings.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
44
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
45 Strings can be concatenated using the notation for defining matrices. For
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
46 example, the expression
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
47
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
48 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
49 [ "foo" , "bar" , "baz" ]
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
50 @end example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
51
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
52 @noindent
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
53 produces the string whose contents are @samp{foobarbaz}. @xref{Numeric Data
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
54 Types}, for more information about creating matrices.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
55
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
56 @menu
11255
d682cd6669ac Update info-based documentation menus to include new nodes.
Rik <octave@nomad.inbox5.com>
parents: 11143
diff changeset
57 * Escape Sequences in String Constants::
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
58 * Character Arrays::
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
59 * Creating Strings::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
60 * Comparing Strings::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
61 * Manipulating Strings::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
62 * String Conversions::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
63 * Character Class Functions::
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
64 @end menu
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
65
11257
8d4c57258523 fix some menu problems in the manual
John W. Eaton <jwe@octave.org>
parents: 11255
diff changeset
66 @node Escape Sequences in String Constants
8d4c57258523 fix some menu problems in the manual
John W. Eaton <jwe@octave.org>
parents: 11255
diff changeset
67 @section Escape Sequences in String Constants
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
68 @cindex escape sequence notation
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
69 In double-quoted strings, the backslash character is used to introduce
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
70 @dfn{escape sequences} that represent other characters. For example,
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
71 @samp{\n} embeds a newline character in a double-quoted string and
14528
c67822beb7a4 maint: Backed out changeset 8c988dabbe8e
Rik <octave@nomad.inbox5.com>
parents: 14527
diff changeset
72 @samp{\"} embeds a double quote character. In single-quoted strings, backslash
c67822beb7a4 maint: Backed out changeset 8c988dabbe8e
Rik <octave@nomad.inbox5.com>
parents: 14527
diff changeset
73 is not a special character. Here is an example showing the difference:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
74
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
75 @example
6556
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6554
diff changeset
76 @group
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
77 toascii ("\n")
6570
49f0820425a8 [project @ 2007-04-24 23:06:56 by jwe]
jwe
parents: 6556
diff changeset
78 @result{} 10
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
79 toascii ('\n')
6570
49f0820425a8 [project @ 2007-04-24 23:06:56 by jwe]
jwe
parents: 6556
diff changeset
80 @result{} [ 92 110 ]
6556
8810bbf321ce [project @ 2007-04-20 18:39:40 by jwe]
jwe
parents: 6554
diff changeset
81 @end group
6554
5dde4dc2bcaf [project @ 2007-04-20 17:16:50 by jwe]
jwe
parents: 6549
diff changeset
82 @end example
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
83
14528
c67822beb7a4 maint: Backed out changeset 8c988dabbe8e
Rik <octave@nomad.inbox5.com>
parents: 14527
diff changeset
84 Here is a table of all the escape sequences used in Octave (within
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
85 double quoted strings). They are the same as those used in the C
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
86 programming language.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
87
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
88 @table @code
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
89 @item \\
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
90 Represents a literal backslash, @samp{\}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
91
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
92 @item \"
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
93 Represents a literal double-quote character, @samp{"}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
94
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
95 @item \'
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
96 Represents a literal single-quote character, @samp{'}.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
97
3893
abd8659eea11 [project @ 2002-04-09 21:36:31 by jwe]
jwe
parents: 3428
diff changeset
98 @item \0
16826
a4969508008e doc: Periodic spellcheck of the documentation.
Rik <rik@octave.org>
parents: 16772
diff changeset
99 Represents the null character, control-@@, ASCII code 0.
3893
abd8659eea11 [project @ 2002-04-09 21:36:31 by jwe]
jwe
parents: 3428
diff changeset
100
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
101 @item \a
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
102 Represents the ``alert'' character, control-g, ASCII code 7.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
103
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
104 @item \b
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
105 Represents a backspace, control-h, ASCII code 8.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
106
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
107 @item \f
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
108 Represents a formfeed, control-l, ASCII code 12.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
109
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
110 @item \n
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
111 Represents a newline, control-j, ASCII code 10.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
112
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
113 @item \r
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
114 Represents a carriage return, control-m, ASCII code 13.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
115
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
116 @item \t
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
117 Represents a horizontal tab, control-i, ASCII code 9.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
118
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
119 @item \v
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
120 Represents a vertical tab, control-k, ASCII code 11.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
121
17244
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
122 @item \@var{nnn}
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
123 Represents the octal value @var{nnn}, where @var{nnn} are one to three
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
124 digits between 0 and 7. For example, the code for the ASCII ESC
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
125 (escape) character is @samp{\033}.
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
126
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
127 @item \x@var{hh}@dots{}
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
128 Represents the hexadecimal value @var{hh}, where @var{hh} are hexadecimal
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
129 digits (@samp{0} through @samp{9} and either @samp{A} through @samp{F} or
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
130 @samp{a} through @samp{f}). Like the same construct in @sc{ansi} C,
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
131 the escape sequence continues until the first non-hexadecimal digit is seen.
9de751a10910 Add support for hexadecimal escape sequences in double-quoted strings (bug #39775)
Mike Miller <mtmiller@ieee.org>
parents: 17152
diff changeset
132 However, using more than two hexadecimal digits produces undefined results.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
133 @end table
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
134
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
135 In a single-quoted string there is only one escape sequence: you may insert a
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
136 single quote character using two single quote characters in succession. For
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
137 example,
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
138
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
139 @example
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
140 @group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
141 'I can''t escape'
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
142 @result{} I can't escape
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
143 @end group
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
144 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
145
14528
c67822beb7a4 maint: Backed out changeset 8c988dabbe8e
Rik <octave@nomad.inbox5.com>
parents: 14527
diff changeset
146 In scripts the two different string types can be distinguished if necessary
13943
5820f8ce683e doc: Add undocumented functions to manual for 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 12581
diff changeset
147 by using @code{is_dq_string} and @code{is_sq_string}.
5820f8ce683e doc: Add undocumented functions to manual for 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 12581
diff changeset
148
5820f8ce683e doc: Add undocumented functions to manual for 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 12581
diff changeset
149 @DOCSTRING(is_dq_string)
5820f8ce683e doc: Add undocumented functions to manual for 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 12581
diff changeset
150
5820f8ce683e doc: Add undocumented functions to manual for 3.6.0 release
Rik <octave@nomad.inbox5.com>
parents: 12581
diff changeset
151 @DOCSTRING(is_sq_string)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
152
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
153 @node Character Arrays
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
154 @section Character Arrays
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
155
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
156 The string representation used by Octave is an array of characters, so
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
157 internally the string @nospell{@qcode{"dddddddddd"}} is actually a row vector
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
158 of length 10 containing the value 100 in all places (100 is the ASCII code of
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
159 @qcode{"d"}). This lends itself to the obvious generalization to character
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
160 matrices. Using a matrix of characters, it is possible to represent a
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
161 collection of same-length strings in one variable. The convention used in
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
162 Octave is that each row in a character matrix is a separate string, but letting
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
163 each column represent a string is equally possible.
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
164
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
165 The easiest way to create a character matrix is to put several strings
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
166 together into a matrix.
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
167
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
168 @example
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
169 collection = [ "String #1"; "String #2" ];
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
170 @end example
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
171
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
172 @noindent
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
173 This creates a 2-by-9 character matrix.
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
174
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
175 The function @code{ischar} can be used to test if an object is a character
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
176 matrix.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
177
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
178 @DOCSTRING(ischar)
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
179
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
180 To test if an object is a string (i.e., a character vector and not a character
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
181 matrix) you can use the @code{ischar} function in combination with the
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
182 @code{isvector} function as in the following example:
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
183
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
184 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
185 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
186 ischar (collection)
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
187 @result{} 1
8442
502e58a0d44f Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8372
diff changeset
188
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
189 ischar (collection) && isvector (collection)
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
190 @result{} 0
8442
502e58a0d44f Fix docstrings, add examples, references and tests to string functions
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8372
diff changeset
191
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
192 ischar ("my string") && isvector ("my string")
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
193 @result{} 1
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
194 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
195 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
196
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
197 One relevant question is, what happens when a character matrix is
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
198 created from strings of different length. The answer is that Octave
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
199 puts blank characters at the end of strings shorter than the longest
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
200 string. It is possible to use a different character than the
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
201 blank character using the @code{string_fill_char} function.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
202
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
203 @DOCSTRING(string_fill_char)
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
204
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
205 This shows a problem with character matrices. It simply isn't possible to
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
206 represent strings of different lengths. The solution is to use a cell array of
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
207 strings, which is described in @ref{Cell Arrays of Strings}.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
208
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
209 @node Creating Strings
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
210 @section Creating Strings
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
211
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
212 The easiest way to create a string is, as illustrated in the introduction,
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
213 to enclose a text in double-quotes or single-quotes. It is however
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
214 possible to create a string without actually writing a text. The
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
215 function @code{blanks} creates a string of a given length consisting
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
216 only of blank characters (ASCII code 32).
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
217
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
218 @DOCSTRING(blanks)
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
219
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
220 @menu
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
221 * Concatenating Strings::
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
222 * Converting Numerical Data to Strings::
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
223 @end menu
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
224
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
225 @node Concatenating Strings
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
226 @subsection Concatenating Strings
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
227
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
228 Strings can be concatenated using matrix notation
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
229 (@pxref{Strings}, @ref{Character Arrays}) which is often the most natural
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
230 method. For example:
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
231
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
232 @example
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
233 @group
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
234 fullname = [fname ".txt"];
17003
c6a39f7f193d doc: Use '@@' to produce '@' in strings.txi
Rik <rik@octave.org>
parents: 16994
diff changeset
235 email = ["<" user "@@" domain ">"];
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
236 @end group
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
237 @end example
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
238
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
239 @noindent
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
240 In each case it is easy to see what the final string will look like. This
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
241 method is also the most efficient. When using matrix concatenation the parser
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
242 immediately begins joining the strings without having to process
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
243 the overhead of a function call and the input validation of the associated
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
244 function.
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
245
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
246 Nevertheless, there are several other functions for concatenating string
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16826
diff changeset
247 objects which can be useful in specific circumstances: @code{char},
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 17003
diff changeset
248 @code{strvcat}, @code{strcat}, and @code{cstrcat}. Finally, the general
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 17003
diff changeset
249 purpose concatenation functions can be used: see @ref{XREFcat,,cat},
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 17003
diff changeset
250 @ref{XREFhorzcat,,horzcat}, and @ref{XREFvertcat,,vertcat}.
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
251
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
252 @itemize @bullet
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
253 @item All string concatenation functions except @code{cstrcat}
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
254 convert numerical input into character data by taking the corresponding ASCII
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
255 character for each element, as in the following example:
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
256
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
257 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
258 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
259 char ([98, 97, 110, 97, 110, 97])
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
260 @result{} banana
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
261 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
262 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
263
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
264 @item
8372
8dff9cba15fe move str2mat to deprecated and make it a simple wrapper around char
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8351
diff changeset
265 @code{char} and @code{strvcat}
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
266 concatenate vertically, while @code{strcat} and @code{cstrcat} concatenate
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
267 horizontally. For example:
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
268
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
269 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
270 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
271 char ("an apple", "two pears")
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
272 @result{} an apple
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
273 two pears
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
274 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
275
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
276 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
277 strcat ("oc", "tave", " is", " good", " for you")
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
278 @result{} octave is good for you
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
279 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
280 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
281
8372
8dff9cba15fe move str2mat to deprecated and make it a simple wrapper around char
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8351
diff changeset
282 @item @code{char} generates an empty row in the output
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
283 for each empty string in the input. @code{strvcat}, on the other hand,
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
284 eliminates empty strings.
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
285
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
286 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
287 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
288 char ("orange", "green", "", "red")
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
289 @result{} orange
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
290 green
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
291
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
292 red
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
293 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
294
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
295 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
296 strvcat ("orange", "green", "", "red")
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
297 @result{} orange
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
298 green
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
299 red
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
300 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
301 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
302
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
303 @item All string concatenation functions except @code{cstrcat} also accept cell
8372
8dff9cba15fe move str2mat to deprecated and make it a simple wrapper around char
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8351
diff changeset
304 array data (@pxref{Cell Arrays}). @code{char} and
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
305 @code{strvcat} convert cell arrays into character arrays, while @code{strcat}
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
306 concatenates within the cells of the cell arrays:
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
307
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
308 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
309 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
310 char (@{"red", "green", "", "blue"@})
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
311 @result{} red
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
312 green
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
313
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
314 blue
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
315 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
316
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
317 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
318 strcat (@{"abc"; "ghi"@}, @{"def"; "jkl"@})
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
319 @result{}
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
320 @{
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
321 [1,1] = abcdef
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
322 [2,1] = ghijkl
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
323 @}
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
324 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
325 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
326
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
327 @item @code{strcat} removes trailing white space in the arguments (except
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
328 within cell arrays), while @code{cstrcat} leaves white space untouched. Both
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
329 kinds of behavior can be useful as can be seen in the examples:
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
330
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
331 @example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
332 @group
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
333 strcat (["dir1";"directory2"], ["/";"/"], ["file1";"file2"])
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17244
diff changeset
334 @result{} dir1/file1
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
335 directory2/file2
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
336 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
337 @group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
338
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
339 cstrcat (["thirteen apples"; "a banana"], [" 5$";" 1$"])
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
340 @result{} thirteen apples 5$
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
341 a banana 1$
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
342 @end group
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
343 @end example
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
344
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
345 Note that in the above example for @code{cstrcat}, the white space originates
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
346 from the internal representation of the strings in a string array
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
347 (@pxref{Character Arrays}).
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
348 @end itemize
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
349
4358
83d4452bc522 [project @ 2003-02-23 02:16:53 by jwe]
jwe
parents: 4167
diff changeset
350 @DOCSTRING(char)
83d4452bc522 [project @ 2003-02-23 02:16:53 by jwe]
jwe
parents: 4167
diff changeset
351
6502
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
352 @DOCSTRING(strvcat)
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
353
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
354 @DOCSTRING(strcat)
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
355
8286
6f2d95255911 fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7984
diff changeset
356 @DOCSTRING(cstrcat)
6f2d95255911 fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7984
diff changeset
357
17152
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
358 @node Converting Numerical Data to Strings
f2a8592b8fbd doc: Shorten some long subsection names in Manual.
Rik <rik@octave.org>
parents: 17097
diff changeset
359 @subsection Converting Numerical Data to Strings
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
360 Apart from the string concatenation functions (@pxref{Concatenating Strings})
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
361 which cast numerical data to the corresponding ASCII characters, there are
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
362 several functions that format numerical data as strings. @code{mat2str} and
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
363 @code{num2str} convert real or complex matrices, while @code{int2str} converts
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
364 integer matrices. @code{int2str} takes the real part of complex values and
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
365 round fractional values to integer. A more flexible way to format numerical
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
366 data as strings is the @code{sprintf} function (@pxref{Formatted Output},
17097
e7a059a9a644 doc: Use XREF as anchor prefix in documentation for clearer results in Info viewer.
Rik <rik@octave.org>
parents: 17003
diff changeset
367 @ref{XREFsprintf,,sprintf}).
4535
a5f23212a3d8 [project @ 2003-10-16 02:39:15 by jwe]
jwe
parents: 4452
diff changeset
368
6502
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
369 @DOCSTRING(mat2str)
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
370
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
371 @DOCSTRING(num2str)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
372
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
373 @DOCSTRING(int2str)
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
374
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
375 @node Comparing Strings
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
376 @section Comparing Strings
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
377
8828
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8817
diff changeset
378 Since a string is a character array, comparisons between strings work
8463d1a2e544 Doc fixes.
Brian Gough <bjg@network-theory.co.uk>
parents: 8817
diff changeset
379 element by element as the following example shows:
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
380
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
381 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9036
diff changeset
382 @group
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
383 GNU = "GNU's Not UNIX";
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
384 spaces = (GNU == " ")
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
385 @result{} spaces =
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
386 0 0 0 0 0 1 0 0 0 1 0 0 0 0
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9036
diff changeset
387 @end group
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
388 @end example
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
389
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
390 @noindent To determine if two strings are identical it is necessary to use the
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
391 @code{strcmp} function. It compares complete strings and is case
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
392 sensitive. @code{strncmp} compares only the first @code{N} characters (with
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
393 @code{N} given as a parameter). @code{strcmpi} and @code{strncmpi} are the
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
394 corresponding functions for case-insensitive comparison.
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
395
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
396 @DOCSTRING(strcmp)
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
397
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
398 @DOCSTRING(strncmp)
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
399
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
400 @DOCSTRING(strcmpi)
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
401
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
402 @DOCSTRING(strncmpi)
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
403
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
404 @DOCSTRING(validatestring)
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7639
diff changeset
405
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
406 @node Manipulating Strings
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
407 @section Manipulating Strings
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
408
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
409 Octave supports a wide range of functions for manipulating strings.
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
410 Since a string is just a matrix, simple manipulations can be accomplished
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
411 using standard operators. The following example shows how to replace
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
412 all blank characters with underscores.
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
413
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
414 @example
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
415 @group
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9036
diff changeset
416 quote = ...
7081
503001863427 [project @ 2007-10-31 01:08:14 by jwe]
jwe
parents: 7031
diff changeset
417 "First things first, but not necessarily in that order";
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
418 quote( quote == " " ) = "_"
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
419 @result{} quote =
7081
503001863427 [project @ 2007-10-31 01:08:14 by jwe]
jwe
parents: 7031
diff changeset
420 First_things_first,_but_not_necessarily_in_that_order
9036
58604c45ca74 Cleanup of data types related documentation
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
421 @end group
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
422 @end example
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
423
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
424 For more complex manipulations, such as searching, replacing, and
7001
8b0cfeb06365 [project @ 2007-10-10 18:02:59 by jwe]
jwe
parents: 6778
diff changeset
425 general regular expressions, the following functions come with Octave.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
426
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
427 @DOCSTRING(deblank)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
428
8817
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8442
diff changeset
429 @DOCSTRING(strtrim)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8442
diff changeset
430
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
431 @DOCSTRING(strtrunc)
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
432
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
433 @DOCSTRING(findstr)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
434
8817
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8442
diff changeset
435 @DOCSTRING(strchr)
03b7f618ab3d include docstrings for new functions in the manual
John W. Eaton <jwe@octave.org>
parents: 8442
diff changeset
436
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
437 @DOCSTRING(index)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
438
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
439 @DOCSTRING(rindex)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
440
6502
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
441 @DOCSTRING(strfind)
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
442
16408
b1ea3813e37d Add strjoin to strings.txi
Ben Abbott <bpabbott@mac.com>
parents: 14528
diff changeset
443 @DOCSTRING(strjoin)
b1ea3813e37d Add strjoin to strings.txi
Ben Abbott <bpabbott@mac.com>
parents: 14528
diff changeset
444
6502
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
445 @DOCSTRING(strmatch)
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
446
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
447 @DOCSTRING(strtok)
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
448
8879
1beaaffb3c1f document strsplit, not split
John W. Eaton <jwe@octave.org>
parents: 8828
diff changeset
449 @DOCSTRING(strsplit)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
450
16725
57bf164f1608 Add ostrsplit() to the manual.
Ben Abbott <bpabbott@mac.com>
parents: 16408
diff changeset
451 @DOCSTRING(ostrsplit)
57bf164f1608 Add ostrsplit() to the manual.
Ben Abbott <bpabbott@mac.com>
parents: 16408
diff changeset
452
11143
195cffc2d0a3 strings.txi: @DOCSTRING additions.
Ben Abbott <bpabbott@mac.com>
parents: 11103
diff changeset
453 @DOCSTRING(strread)
195cffc2d0a3 strings.txi: @DOCSTRING additions.
Ben Abbott <bpabbott@mac.com>
parents: 11103
diff changeset
454
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
455 @DOCSTRING(strrep)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
456
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
457 @DOCSTRING(substr)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
458
5582
6bf56668b01a [project @ 2005-12-15 01:08:20 by jwe]
jwe
parents: 4946
diff changeset
459 @DOCSTRING(regexp)
6bf56668b01a [project @ 2005-12-15 01:08:20 by jwe]
jwe
parents: 4946
diff changeset
460
6bf56668b01a [project @ 2005-12-15 01:08:20 by jwe]
jwe
parents: 4946
diff changeset
461 @DOCSTRING(regexpi)
6bf56668b01a [project @ 2005-12-15 01:08:20 by jwe]
jwe
parents: 4946
diff changeset
462
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6502
diff changeset
463 @DOCSTRING(regexprep)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6502
diff changeset
464
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7639
diff changeset
465 @DOCSTRING(regexptranslate)
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7639
diff changeset
466
11103
d4fc294a19e4 include untabify docstring in the manual
John W. Eaton <jwe@octave.org>
parents: 10828
diff changeset
467 @DOCSTRING(untabify)
d4fc294a19e4 include untabify docstring in the manual
John W. Eaton <jwe@octave.org>
parents: 10828
diff changeset
468
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3920
diff changeset
469 @node String Conversions
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
470 @section String Conversions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
471
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
472 Octave supports various kinds of conversions between strings and
8351
4d78baf20ded improve string documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8347
diff changeset
473 numbers. As an example, it is possible to convert a string containing
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
474 a hexadecimal number to a floating point number.
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
475
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
476 @example
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9036
diff changeset
477 @group
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
478 hex2dec ("FF")
14402
cbcaf5602469 doc: Make spacing nicer for Strings chapter of manual.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
479 @result{} 255
9209
923c7cb7f13f Simplify TeXinfo files by eliminating redundant @iftex followed by @tex construction.
Rik <rdrider0-list@yahoo.com>
parents: 9036
diff changeset
480 @end group
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
481 @end example
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
482
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
483 @DOCSTRING(bin2dec)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
484
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
485 @DOCSTRING(dec2bin)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
486
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
487 @DOCSTRING(dec2hex)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
488
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
489 @DOCSTRING(hex2dec)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
490
3920
87db95b22f8f [project @ 2002-05-01 04:07:31 by jwe]
jwe
parents: 3893
diff changeset
491 @DOCSTRING(dec2base)
87db95b22f8f [project @ 2002-05-01 04:07:31 by jwe]
jwe
parents: 3893
diff changeset
492
87db95b22f8f [project @ 2002-05-01 04:07:31 by jwe]
jwe
parents: 3893
diff changeset
493 @DOCSTRING(base2dec)
87db95b22f8f [project @ 2002-05-01 04:07:31 by jwe]
jwe
parents: 3893
diff changeset
494
7639
b2fbb393a072 Add the num2hex and hex2num functions
David Bateman <dbateman@free.fr>
parents: 7081
diff changeset
495 @DOCSTRING(num2hex)
b2fbb393a072 Add the num2hex and hex2num functions
David Bateman <dbateman@free.fr>
parents: 7081
diff changeset
496
b2fbb393a072 Add the num2hex and hex2num functions
David Bateman <dbateman@free.fr>
parents: 7081
diff changeset
497 @DOCSTRING(hex2num)
b2fbb393a072 Add the num2hex and hex2num functions
David Bateman <dbateman@free.fr>
parents: 7081
diff changeset
498
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
499 @DOCSTRING(str2double)
3920
87db95b22f8f [project @ 2002-05-01 04:07:31 by jwe]
jwe
parents: 3893
diff changeset
500
6623
545847da3b88 [project @ 2007-05-15 02:23:08 by jwe]
jwe
parents: 6570
diff changeset
501 @DOCSTRING(strjust)
6502
6ab0a8767780 [project @ 2007-04-06 03:32:06 by jwe]
jwe
parents: 6501
diff changeset
502
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
503 @DOCSTRING(str2num)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
504
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
505 @DOCSTRING(toascii)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
506
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
507 @DOCSTRING(tolower)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
508
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
509 @DOCSTRING(toupper)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
510
3428
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
511 @DOCSTRING(do_string_escapes)
5b77cf82393c [project @ 2000-01-14 02:54:53 by jwe]
jwe
parents: 3402
diff changeset
512
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
513 @DOCSTRING(undo_string_escapes)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
514
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3920
diff changeset
515 @node Character Class Functions
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
516 @section Character Class Functions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
517
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
518 Octave also provides the following character class test functions
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
519 patterned after the functions in the standard C library. They all
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
520 operate on string arrays and return matrices of zeros and ones.
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
521 Elements that are nonzero indicate that the condition was true for the
10828
322f43e0e170 Grammarcheck .txi documentation files.
Rik <octave@nomad.inbox5.com>
parents: 9209
diff changeset
522 corresponding character in the string array. For example:
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
523
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
524 @example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
525 @group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
526 isalpha ("!Q@@WERT^Y&")
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
527 @result{} [ 0, 1, 0, 1, 1, 1, 1, 0, 1, 0 ]
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
528 @end group
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
529 @end example
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
530
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
531 @DOCSTRING(isalnum)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
532
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
533 @DOCSTRING(isalpha)
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
534
6549
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6502
diff changeset
535 @DOCSTRING(isletter)
5a5a09d7deb8 [project @ 2007-04-20 06:55:29 by jwe]
jwe
parents: 6502
diff changeset
536
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
537 @DOCSTRING(islower)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
538
12581
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
539 @DOCSTRING(isupper)
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
540
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
541 @DOCSTRING(isdigit)
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
542
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
543 @DOCSTRING(isxdigit)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
544
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
545 @DOCSTRING(ispunct)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
546
3361
4f40efa995c1 [project @ 1999-11-19 21:19:37 by jwe]
jwe
parents: 3294
diff changeset
547 @DOCSTRING(isspace)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
548
12581
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
549 @DOCSTRING(iscntrl)
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
550
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
551 @DOCSTRING(isgraph)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
552
12581
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
553 @DOCSTRING(isprint)
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
554
c8be316f9543 Group commonly used isXXX functions together in documentation.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
555 @DOCSTRING(isascii)
7984
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7639
diff changeset
556
bbaa5d7d0143 Some documentation updates
David Bateman <dbateman@free.fr>
parents: 7639
diff changeset
557 @DOCSTRING(isstrprop)