kaven-basic - v6.0.0
    Preparing search index...

    Function ContainsSubstringOnlyOnce

    • Determines whether each of the specified substrings appears exactly once in the given string.

      Parameters

      • str: string

        The string to search within.

      • ...substrings: string[]

        One or more substrings to check for single occurrence in str.

      Returns boolean

      true if every substring appears exactly once in str, otherwise false.

      ContainsSubstringOnlyOnce("hello world", "hello"); // true
      ContainsSubstringOnlyOnce("hello hello world", "hello"); // false
      ContainsSubstringOnlyOnce("hello world", "hello", "world"); // true
      ContainsSubstringOnlyOnce("hello world", "hello", "foo"); // false

      4.0.0

      2021-12-14