Ask Question
12 November, 21:25

Write a function named beginsWith () that computes how many strings in a list of strings begin with

a specified letter.

The function beginsWith () takes two parameters:

1. letter, a string of length 1

2. strList, a list of 0 or more strings

The function beginsWith () should return an integer that is the number of strings in strList that begin

with letter.

+2
Answers (1)
  1. 13 November, 00:02
    0
    It's php I guess. So I suggest you to try this^

    function beginWith ($haystack, $needle, $case = true) {

    if ($case) {

    return (strcmp (substr ($haystack, 0, strlen ($needle)), $needle) = = = 0);

    }

    return (strcasecmp (substr ($haystack, 0, strlen ($needle)), $needle) = = = 0);

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function named beginsWith () that computes how many strings in a list of strings begin with a specified letter. The function ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers