home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 November / Chip_2003-11_cd1.bin / software / dave / dqsd.exe / searches / ccase.xml < prev    next >
Text File  |  2003-01-14  |  3KB  |  80 lines

  1. <search function="ccase">
  2.   <name>Change case</name>
  3.   <description>
  4.     Change case of string to capitalized, lowercase, or uppercase.<br/>
  5.     <div class="helpboxDescLabels">Switches:</div>
  6.     <table class="helpboxDescTable">
  7.           <tr><td>/capitalize</td><td>Capitalize the first letter, lowercase the rest of each word.</td></tr>
  8.           <tr><td>/lowercase</td><td>Lowercase all words</td></tr>
  9.           <tr><td>/uppercase</td><td>Uppercase all words</td></tr>
  10.       </table>
  11.     <div class="helpboxDescLabels">Example:</div>
  12.     <table class="helpboxDescTable">
  13.           <tr><td>Capitalize:</td><td>ccase Today is a Monday.</td></tr>
  14.           <tr><td>Capitalize:</td><td>ccase /c Today is a Monday.</td></tr>
  15.           <tr><td>Lowercase:</td><td>ccase /l Today is a Monday.</td></tr>
  16.           <tr><td>Uppercase:</td><td>ccase /u Today is a Monday.</td></tr>
  17.       </table>
  18.   </description>
  19.   <category>Functions</category>
  20.   <contributor>Sarah Sweeney</contributor>
  21.   <email>poohbear@designshift.com</email>
  22.   
  23.   <script><![CDATA[
  24.     function capitalizeCase(str)
  25.     { temp = "";
  26.       words = str.split(" ");
  27.       if (words.length > 0)
  28.       { for (i = 0; i < words.length; i++)
  29.         { if (temp != "") temp += " ";
  30.           word = words[i];
  31.           first = word.charAt(0);
  32.           first = first.toUpperCase();
  33.           rest = word.slice(1,word.length).toLowerCase();
  34.           temp = temp + first + rest;
  35.         }
  36.       }
  37.       return temp;
  38.     }
  39.     function lowerCase(str)
  40.     { return str.toLowerCase();
  41.     }
  42.     function upperCase(str)
  43.     { return str.toUpperCase();
  44.     }
  45.     function ccase(q, switches)
  46.       { if (nullArgs("ccase", q)) return false;
  47.  
  48.       var args = parseArgs(q, "capitalize, lowercase, uppercase");
  49.  
  50.       str = "";
  51.  
  52.         if (args.switches.length > 0) {
  53.         switch (args.switches[0].name)
  54.         { case "lowercase":
  55.             str = lowerCase(args.q);
  56.             break;
  57.           case "uppercase":
  58.             str = upperCase(args.q);
  59.                   break;
  60.           case "capitalize":
  61.             str = capitalizeCase(args.q);
  62.                   break;
  63.           default:
  64.             str = capitalizeCase(args.q);
  65.             break;
  66.         }
  67.       }
  68.       else str = capitalizeCase(args.q);
  69.  
  70.       setSearchWindowText(str, true);
  71.     }
  72.   ]]></script>
  73.  
  74.   <copyright>
  75.     Copyright (c) 2002 David Bau
  76.     Distributed under the terms of the
  77.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  78.   </copyright>
  79. </search>
  80.