comparison toolboxes/xml_toolbox/strsplit.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 %function cstr = strsplit(strarr, ch)
2 %
3 % FUNCTIONALITY
4 % Splits string <strarr> at positions where substring <ch>
5 % occurs. If <ch> is not given, then ascii character 10
6 % (newline) is the splitting position.
7 % This would split for example a read-in file into its lines.
8 %
9 % INPUT
10 % strarr string to split
11 % ch optional, character or substring at which to split,
12 % default is character ascii 10 = 'newline'
13 %
14 % OUTPUT
15 % cstr cell array of strings, all leading and trailing
16 % spaces are deleted. Substring ch is removed from string.
17 %
18 % EXAMPLES
19 % a = strsplit('aaa bbb ccc ', ' ')
20 % Result: a{1}='aaa', a{2}='bbb', a{3}='ccc'
21 % a = strsplit('user@server', '@')
22 % Result: a{1}='user', a{3}='server'
23 % a = strsplit('aabbccddeeffgg', 'dd')
24 % Result: a{1}='aabbcc', a{2} = 'eeffgg'
25 %
26 % RELATED
27 % strfun, depreciated stringify.m
28
29 % Copyright (C) 2002 Marc Molinari, University of Southampton
30 % Author: Dr Marc Molinari <m.molinari@soton.ac.uk>
31 % $Revision: 1.1 $ $Date: 2005/04/15 17:12:14 $ $Tag$
32