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