]> Creatis software - CreaPhase.git/blob - octave_packages/strings-1.1.0/strsort.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / strings-1.1.0 / strsort.m
1 ## Author: Paul Kienzle <pkienzle@users.sf.net>
2 ## This program is granted to the public domain.
3
4 ## -*- texinfo -*-
5 ## @deftypefn {Function File} {[@dots{}] =} strsort (@dots{})
6 ## Overloads the sort function to operate on strings.
7 ##
8 ## @seealso {sort}
9 ## @end deftypefn
10
11 # PKG_ADD dispatch ("sort", "strsort", "string")
12 function [sorted,idx] = strsort(string,varargin)
13   if nargout == 2
14     [s,idx] = sort(toascii(string),varargin{:});
15   else
16     s = sort(toascii(string),varargin{:});
17   endif
18   sorted = char(s);
19 endfunction