summaryrefslogtreecommitdiff
path: root/ipl/procs/title.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/procs/title.icn')
-rw-r--r--ipl/procs/title.icn44
1 files changed, 44 insertions, 0 deletions
diff --git a/ipl/procs/title.icn b/ipl/procs/title.icn
new file mode 100644
index 0000000..5aa61ba
--- /dev/null
+++ b/ipl/procs/title.icn
@@ -0,0 +1,44 @@
+############################################################################
+#
+# File: title.icn
+#
+# Subject: Procedure to produce title portion of name
+#
+# Author: Ralph E. Griswold
+#
+# Date: March 25, 2002
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This procedure produces the "title" of a name, as "Mr." from
+# "Mr. John Doe".
+#
+# The process is imperfect.
+#
+############################################################################
+#
+# Links: titleset
+#
+############################################################################
+
+link titleset
+
+procedure title(name)
+ local result
+ static titles
+
+ initial titles := titleset()
+
+ result := ""
+
+ name ? {
+ while result ||:= =!titles || " " do
+ tab(many(' \t'))
+ return result ? tab(-1 | 0)
+ }
+
+end