File: strsort.m

package info (click to toggle)
octave-strings 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 116 kB
  • ctags: 9
  • sloc: cpp: 73; makefile: 7
file content (19 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Author: Paul Kienzle <pkienzle@users.sf.net>
## This program is granted to the public domain.

## -*- texinfo -*-
## @deftypefn {Function File} {[@dots{}] =} strsort (@dots{})
## Overloads the sort function to operate on strings.
##
## @seealso {sort}
## @end deftypefn

# PKG_ADD dispatch ("sort", "strsort", "string")
function [sorted,idx] = strsort(string,varargin)
  if nargout == 2
    [s,idx] = sort(toascii(string),varargin{:});
  else
    s = sort(toascii(string),varargin{:});
  endif
  sorted = char(s);
endfunction