<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Man case pattern - Revision history</title>
		<link>http://wiki.lostsouls.org/w/index.php?title=Man_case_pattern&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.8.2</generator>
		<lastBuildDate>Sun, 26 Apr 2026 09:54:29 GMT</lastBuildDate>
		<item>
			<title>Laine at 19:22, 11 June 2007</title>
			<link>http://wiki.lostsouls.org/w/index.php?title=Man_case_pattern&amp;diff=3956&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Files==&lt;br /&gt;
 /def/descriptor/case_pattern.c&lt;br /&gt;
 /lib/descriptors/case_pattern.h&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Case pattern descriptors implement a mechanism that allows you to abstract&lt;br /&gt;
the pattern of upper and lower case letters from a string, manipulate it in&lt;br /&gt;
lower-case, and then restore the original case pattern when you are done.&lt;br /&gt;
The way this usually goes is like so:&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;case_pattern.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  string text = get_some_text();&lt;br /&gt;
  descriptor pat = Case_Pattern_Extract(&amp;amp;text);&lt;br /&gt;
  text = transform_the_text_in_various_ways(text);&lt;br /&gt;
  text = Case_Pattern_Restore(text, pat);&lt;br /&gt;
&lt;br /&gt;
Note that the argument to Case_Pattern_Extract() is being passed by&lt;br /&gt;
reference.  This causes it to be converted to lower-case.  You do not have&lt;br /&gt;
to pass the argument by reference if you do not want it to be converted to&lt;br /&gt;
lower-case.&lt;br /&gt;
&lt;br /&gt;
This is usually all you need to know about the mechanism; the fields of&lt;br /&gt;
the descriptor and so forth are all managed internally.  The remainder of&lt;br /&gt;
this document is provided for reference purposes.&lt;br /&gt;
&lt;br /&gt;
===Public Fields===&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type: The type of the case pattern.  This is one of the&lt;br /&gt;
following:&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_Indeterminate: No representable case pattern was&lt;br /&gt;
found in the original text.  This generally means the original text&lt;br /&gt;
contained no letters.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_All_Upper: All letters in the original text were&lt;br /&gt;
upper-case.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_All_Lower: All letters in the original text were&lt;br /&gt;
lower-case.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_First_Upper: The first letter in the original text&lt;br /&gt;
was upper-case and the remainder were lower-case.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_First_Lower: The first letter in the original text&lt;br /&gt;
was lower-case and the remainder were upper-case.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_Words_Upper: The original text had a capital letter&lt;br /&gt;
at the beginning of each word, as if it were the output of the call&lt;br /&gt;
capitalize_words(some_text).&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_Main_Words_Upper: The original text had a capital&lt;br /&gt;
letter at the beginning of each word, as if it were the output of the&lt;br /&gt;
call capitalize_words(some_text, True).&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Type_Complex: The original text had a complex case&lt;br /&gt;
pattern, as specified in the Case_Pattern_Content field.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Original: The original text the case pattern is based on.&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Altered: The text with the case pattern extracted (converted&lt;br /&gt;
to lower-case).&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Content: For Case_Pattern_Type_Complex patterns, an array&lt;br /&gt;
describing the case pattern in the original text.  Each element will be&lt;br /&gt;
either Case_Pattern_Element_Upper, Case_Pattern_Element_Lower, or&lt;br /&gt;
Case_Pattern_Neither, corresponding to one letter in the original text.&lt;br /&gt;
&lt;br /&gt;
===Internal Fields===&lt;br /&gt;
&lt;br /&gt;
Case_Pattern_Tag: The tag value for the descriptor system.&lt;br /&gt;
&lt;br /&gt;
===Support Functions===&lt;br /&gt;
&lt;br /&gt;
'''descriptor Case_Pattern_Extract(string text)'''&lt;br /&gt;
&lt;br /&gt;
Extracts the case pattern from the specified text and returns it.  If&lt;br /&gt;
the text is passed by reference, it will be converted to lower-case.&lt;br /&gt;
&lt;br /&gt;
'''string Case_Pattern_Restore(string text, descriptor dxr)'''&lt;br /&gt;
&lt;br /&gt;
Coerces the specified text into the case pattern described by the&lt;br /&gt;
descriptor passed and returns the result.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
[[man lower case|lower_case(efun)]], [[man upper case|upper_case(efun)]], [[man capitalize|capitalize(efun)]], [[man capitalize words|capitalize_words(sefun)]], [[man descriptors|descriptors(mechanisms)]]&lt;/div&gt;</description>
			<pubDate>Mon, 11 Jun 2007 19:22:31 GMT</pubDate>			<dc:creator>Laine</dc:creator>			<comments>http://wiki.lostsouls.org/Talk:Man_case_pattern</comments>		</item>
	</channel>
</rss>