Поделиться через


IndexOfString

Applies to: Lync 2013 | Lync Server 2013

IndexOfString

The IndexOfString function returns the zero-based index of the first occurrence of the search string in the input string. If the Search string is not found, the function returns -1.

Syntax

int IndexOfString(
  string targetString,
  string searchString,
  bool ignoreCase
);

Parameters

  • targetString
    The string to be searched.

  • searchString
    The string to search for.

  • ignoreCase
    Optional. If set to true, the search will be case-sensitive. If either set to false or not set, the search will be case-insensitive.

Return values

Returns a zero-based index of the first occurrence of the search string in the input string. If the search string is not found, returns -1. Also, it returns -1 if either targetString or searchString is empty, null or the length of the target string is less than that of the search string.