Mercurial > octave
comparison scripts/strings/blanks.m @ 2268:ee5ec3133ed3
[project @ 1996-05-24 00:53:19 by jwe]
Initial revision
author | jwe |
---|---|
date | Fri, 24 May 1996 00:53:19 +0000 |
parents | |
children | 6dedd4e0a82f |
comparison
equal
deleted
inserted
replaced
2267:4028b7c79927 | 2268:ee5ec3133ed3 |
---|---|
1 # Copyright (C) 1996 John W. Eaton | |
2 # | |
3 # This file is part of Octave. | |
4 # | |
5 # Octave is free software; you can redistribute it and/or modify it | |
6 # under the terms of the GNU General Public License as published by the | |
7 # Free Software Foundation; either version 2, or (at your option) any | |
8 # later version. | |
9 # | |
10 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 # for more details. | |
14 # | |
15 # You should have received a copy of the GNU General Public License | |
16 # along with Octave; see the file COPYING. If not, write to the Free | |
17 # Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
18 | |
19 function s = blanks (n) | |
20 | |
21 # usage: blanks (n) | |
22 # | |
23 # Returns a string of n blanks. | |
24 | |
25 # Original version by Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>. | |
26 | |
27 if (nargin != 1) | |
28 usage ("blanks (n)"); | |
29 endif | |
30 | |
31 if (is_scalar (n) && n > 0 && n == round (n)) | |
32 s = setstr (ones (1, n) * toascii (" ")); | |
33 else | |
34 error ("blanks: n must be a positive integer"); | |
35 endif | |
36 | |
37 endfunction | |
38 | |
39 | |
40 | |
41 |