WordCount.xml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
  4. <sect1 id="WordCount">
  5. <title>WordCount</title>
  6. <para><emphasis role="bold">STD.Str.WordCount<indexterm>
  7. <primary>STD.Str.WordCount</primary>
  8. </indexterm><indexterm>
  9. <primary>Str.WordCount</primary>
  10. </indexterm><indexterm>
  11. <primary>WordCount</primary>
  12. </indexterm>(</emphasis> <emphasis>source</emphasis><emphasis role="bold">
  13. )</emphasis></para>
  14. <para><emphasis role="bold">STD.Uni.WordCount<indexterm>
  15. <primary>STD.Uni.WordCount</primary>
  16. </indexterm><indexterm>
  17. <primary>Uni.WordCount</primary>
  18. </indexterm>(</emphasis> <emphasis>source </emphasis><emphasis
  19. role="bold">[</emphasis><emphasis>, locale </emphasis><emphasis role="bold">
  20. ] )</emphasis></para>
  21. <informaltable colsep="1" frame="all" rowsep="1">
  22. <tgroup cols="2">
  23. <colspec colwidth="80.50pt" />
  24. <colspec />
  25. <tbody>
  26. <row>
  27. <entry><emphasis>source</emphasis></entry>
  28. <entry>A string containing the words to count. Words are delimited
  29. by spaces.</entry>
  30. </row>
  31. <row>
  32. <entry><emphasis>locale</emphasis></entry>
  33. <entry>A null-terminated string containing the language and country
  34. code to use to determine correct sort order and other
  35. operations.</entry>
  36. </row>
  37. <row>
  38. <entry>Return:</entry>
  39. <entry>WordCount returns an integer value.</entry>
  40. </row>
  41. </tbody>
  42. </tgroup>
  43. </informaltable>
  44. <para>The <emphasis role="bold">WordCount </emphasis>function returns the
  45. number of words in the <emphasis>source</emphasis> string.</para>
  46. <para>Example:</para>
  47. <programlisting format="linespecific">IMPORT Std;
  48. str1 := 'a word a day keeps the doctor away';
  49. output(LENGTH(TRIM(Str1,LEFT,RIGHT)) - LENGTH(TRIM(Str1,ALL)) + 1);
  50. //finds eight words by removing spaces
  51. STD.Str.WordCount(str1); //finds eight words based on space delimiter
  52. </programlisting>
  53. <para></para>
  54. </sect1>