1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<html lang="en">
<head>
<title>Creating Strings - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Strings.html#Strings" title="Strings">
<link rel="prev" href="Character-Arrays.html#Character-Arrays" title="Character Arrays">
<link rel="next" href="Comparing-Strings.html#Comparing-Strings" title="Comparing Strings">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Creating-Strings"></a>
<p>
Next: <a rel="next" accesskey="n" href="Comparing-Strings.html#Comparing-Strings">Comparing Strings</a>,
Previous: <a rel="previous" accesskey="p" href="Character-Arrays.html#Character-Arrays">Character Arrays</a>,
Up: <a rel="up" accesskey="u" href="Strings.html#Strings">Strings</a>
<hr>
</div>
<h3 class="section">5.3 Creating Strings</h3>
<p>The easiest way to create a string is, as illustrated in the introduction,
to enclose a text in double-quotes or single-quotes. It is however
possible to create a string without actually writing a text. The
function <code>blanks</code> creates a string of a given length consisting
only of blank characters (ASCII code 32).
<!-- blanks scripts/strings/blanks.m -->
<p><a name="doc_002dblanks"></a>
<div class="defun">
— Function File: <b>blanks</b> (<var>n</var>)<var><a name="index-blanks-332"></a></var><br>
<blockquote><p>Return a string of <var>n</var> blanks, for example:
<pre class="example"> blanks (10);
whos ans;
⇒
Attr Name Size Bytes Class
==== ==== ==== ===== =====
ans 1x10 10 char
</pre>
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002drepmat.html#doc_002drepmat">repmat</a>.
</p></blockquote></div>
<ul class="menu">
<li><a accesskey="1" href="Concatenating-Strings.html#Concatenating-Strings">Concatenating Strings</a>
<li><a accesskey="2" href="Conversion-of-Numerical-Data-to-Strings.html#Conversion-of-Numerical-Data-to-Strings">Conversion of Numerical Data to Strings</a>
</ul>
</body></html>
|