StringPlus: Difference between revisions

1,136 bytes added ,  22 May 2009
no edit summary
*>Monkey 05 06
No edit summary
*>Monkey 05 06
No edit summary
Line 314: Line 314:


Returns the index of the '''N'''th character in this String not contained within the specified '''CHARACTERSET'''. See {{link||String.IndexOfNth|IndexOfNth}} for description of other parameters.
Returns the index of the '''N'''th character in this String not contained within the specified '''CHARACTERSET'''. See {{link||String.IndexOfNth|IndexOfNth}} for description of other parameters.
{{textcolor|#FF0000|Example:}}
  String haystack = "This is some text.";
  int result = haystack.FindNthNotOf(" .,;:!?", 8);
  if (result != -1) {
    Display("the 8th non-space, non-punctuation character is at index %d", result);
  }
Will display "the 8th non-space, non-punctuation character is at index 9".
''See Also:'' {{link||String.ContainsHowManyOf}}, {{link||String.ContainsNOf}}, {{link||String.IndexOfNth}}, {{link||String.FindNthOf}}


====String.FindNthOf====
====String.FindNthOf====
Line 319: Line 331:


Returns the index of the '''N'''th character in this String contained within the specified '''CHARACTERSET'''. See {{link||String.IndexOfNth|IndexOfNth}} for description of other parameters.
Returns the index of the '''N'''th character in this String contained within the specified '''CHARACTERSET'''. See {{link||String.IndexOfNth|IndexOfNth}} for description of other parameters.
{{textcolor|#FF0000|Example:}}
  String haystack = "This is some text.";
  int result = haystack.FindNthOf(" .,;:!?", 8);
  if (result != -1) {
    Display("the 8th space or punctuation character is at index %d", result);
  }
Will display "the 8th space or punctuation character is at index 17". Since ''returnLast'' defaults to '''true''' we here see the ''last'' character from the ''characterSet'' which is actually the 4th instance, not the 8th. If we had specified ''returnLast'' as '''false''' then this function would have returned -1.
''See Also:'' {{link||String.ContainsHowManyOf}}, {{link||String.ContainsNOf}}, {{link||String.IndexOfNth}}, {{link||String.FindNthNotOf}}


====String.StartsWithAllOf====
====String.StartsWithAllOf====
Anonymous user