Monday, November 08, 2010 at 12:03 AM.

system.verbs.builtins.html.directory.getCanonicalName

on getCanonicalName (linetext) {
	<<Changes
		<<5/12/02; 12:14:05 AM by JES
			<<Drop all characters whose ascii value is above 127.
		<<11/6/2000; 6:12:56 PM by DW
			<<Take everything to the left of the hyphen (if present), remove all punctuation, and innerCase it. This is the string we use to refer to the directory page in a URI.
	local (i, name = linetext);
	for i = 1 to sizeof (name) {
		if name [i] == '-' {
			if i < sizeof (name) {
				if name [i + 1] == ' ' {
					name = string.trimwhitespace (string.mid (name, 1, i));
					break}}}};
	local (ch);
	for i = sizeof (name) downto 1 {
		ch = name [i];
		if (not string.isalpha (ch)) and (not string.isnumeric (ch)) and (ch != ' ') {
			name = string.delete (name, i, 1)}
		else {
			if number (ch) > 127 {
				name = string.delete (name, i, 1)}}};
	return (string.innerCaseName (name))}
<<bundle //test code
	<<dialog.alert (getCanonicalName ("xml-rpc"))



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.