3902
|
1 diff -urN strings.orig/inst/strjoin.m strings/inst/strjoin.m |
|
2 --- strings.orig/inst/strjoin.m 2015-04-13 21:40:26.000000000 -0400 |
|
3 +++ strings/inst/strjoin.m 1969-12-31 19:00:00.000000000 -0500 |
|
4 @@ -1,54 +0,0 @@ |
|
5 -## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai@uta.edu> |
|
6 -## |
|
7 -## This program is free software; you can redistribute it and/or modify it under |
|
8 -## the terms of the GNU General Public License as published by the Free Software |
|
9 -## Foundation; either version 3 of the License, or (at your option) any later |
|
10 -## version. |
|
11 -## |
|
12 -## This program is distributed in the hope that it will be useful, but WITHOUT |
|
13 -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
15 -## details. |
|
16 -## |
|
17 -## You should have received a copy of the GNU General Public License along with |
|
18 -## this program; if not, see <http://www.gnu.org/licenses/>. |
|
19 - |
|
20 -## -*- texinfo -*- |
|
21 -## @deftypefn {Function File} {@var{rval} =} strjoin (@var{prefixstr}, @var{stringcell}) |
|
22 -## @deftypefnx {Function File} {@var{rval} =} strjoin (@var{prefixstr}, @var{varargs}) |
|
23 -## Joins the strings in @var{stringcell} with the @var{prefixstr} like the list-join |
|
24 -## function in Python; the second version allows usage with variable number of arguments. |
|
25 -## Note that, if using cell-array as a second argument, only 2 arguments are accepted. |
|
26 -## Also note that, both the arguments are strings or containers of strings (cells). |
|
27 -## |
|
28 -## @example |
|
29 -## @group |
|
30 -## strjoin(' loves-> ','marie','amy','beth') |
|
31 -## ##returns 'marie loves-> amy loves-> beth' |
|
32 -## |
|
33 -## strjoin('*',@{'Octave','Scilab','Lush','Yorick'@}) |
|
34 -## ##returns 'Octave*Scilab*Lush*Yorick' |
|
35 -## @end group |
|
36 -## @end example |
|
37 -## @seealso {strcmp} |
|
38 -## @end deftypefn |
|
39 - |
|
40 -function rval = strjoin (spacer, varargin) |
|
41 - if (nargin < 2) || (nargin > 2 && iscell(varargin{1}) ) |
|
42 - print_usage(); |
|
43 - end |
|
44 - |
|
45 - if iscell(varargin{1}) |
|
46 - varargin=varargin{1}; |
|
47 - end |
|
48 - |
|
49 - rval=""; |
|
50 - L=length(varargin); |
|
51 - for idx=1:(L-1) |
|
52 - rval=strcat(rval,sprintf('%s%s',varargin{idx},spacer)); |
|
53 - end |
|
54 - rval=strcat(rval,varargin{L}); |
|
55 -endfunction |
|
56 - |
|
57 -%!assert(strjoin("-","hello"),"hello") |
|
58 -%!assert(strjoin('*',{'Octave','Scilab','Lush','Yorick'}),'Octave*Scilab*Lush*Yorick') |
|
59 diff -urN strings.orig/src/Makefile strings/src/Makefile |
|
60 --- strings.orig/src/Makefile 2015-04-13 21:40:26.000000000 -0400 |
|
61 +++ strings/src/Makefile 2015-04-13 21:40:48.000000000 -0400 |
|
62 @@ -1,9 +1,10 @@ |
|
63 MKOCTFILE = mkoctfile -Wall |
|
64 +PCRE_LIBS := $(shell pcre-config --libs) |
|
65 |
|
66 all: pcregexp.oct |
|
67 |
|
68 %.oct: %.cc |
|
69 - $(MKOCTFILE) $< |
|
70 + $(MKOCTFILE) $< $(PCRE_LIBS) |
|
71 |
|
72 clean: |
|
73 rm -f *.o octave-core core *.oct *~ |