#195 Please add method \\\'caselessWordPos\\\' to the String class

v3.2.0
closed
nobody
Classes (154)
5
2012-08-14
2007-06-22
No

Please add a caseless version of the 'wordPos' method, named 'caselessWordPos' to the String class.

Discussion

  • Rick McGuire

    Rick McGuire - 2007-06-22

    Logged In: YES
    user_id=1125291
    Originator: NO

    Committed revision 498.

     
  • Rick McGuire

    Rick McGuire - 2007-06-22

    Logged In: YES
    user_id=1125291
    Originator: NO

    Here is the documentation change.

    caselessWordPos <indexterm><primary>caselessWordPos method</primary> <secondary>of String class</secondary></indexterm> <indexterm><primary>method</primary> <secondary>wordPos method</secondary> <tertiary>of String class</tertiary></indexterm> <indexterm><primary>word</primary> <secondary>locating in a string</secondary></indexterm> <programlisting> >-caselessWordPos(phrase-+--------+-)--------------------------------->< +-,start-+ ]]> </programlisting> <para>Returns the word number of the first word of <emphasis role="italic">phrase</emphasis> found in the receiving string, or <computeroutput>0</computeroutput> if <emphasis role="italic">phrase</emphasis> contains no words or if <emphasis role="italic">phrase</emphasis> is not found. Word matches are made independent of case. Several blanks between words in either <emphasis role="italic">phrase</emphasis> or the receiving string are treated as a single blank for the comparison, but, otherwise, the words must match exactly.</para> <para>By default the search starts at the first word in the receiving string. You can override this by specifying <emphasis role="italic">start</emphasis> (which must be positive), the word at which the search is to be started.</para> <para><emphasis role="bold">Examples:</emphasis></para> <indexterm><primary>examples</primary> <secondary>wordPos method</secondary></indexterm> <programlisting> "now is the time"~caselessWordPos("the") -> 3 "now is the time"~caselessWordPos("The") -> 3 "now is the time"~caselessWordPos("IS THE") -> 2 "now is the time"~caselessWordPos("is the") -> 2 "now is the time"~caselessWordPos("is time ") -> 0 "To be or not to be"~caselessWordPos("BE") -> 2 "To be or not to be"~caselessWordPos("BE",3) -> 6 </programlisting>
     
  • David Ashley

    David Ashley - 2007-06-25

    Logged In: YES
    user_id=931756
    Originator: NO

    Docs updated revision 505.

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks