Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You will write a function called as character_finder which will find the number of existence of as specific character in a text file. The function
You will write a function called as "character_finder" which will find the number of existence of as specific character in a text file. The function will take two input arguments; 1) "fileName" as the char vector of the filename and ii) the character" as the specific character that will be counted. The returning argument will be called as numberOfChar", the number of characters that are found. If the input argument "character" not a valid char or if the file does not exist in the working directory, the function will return -1 The test file that can be used to test your code is attached to this question with the name of "test_file.txt". Please test your code with that file and compare your results with the below test cases. Example usages of the function is given below; Please upload your written function as a m.file (if.m file type is not supported, please upload your function as a txt file). >> charnum = character_finder('test_file.txt', '') charnum 39 >> charnum = character_finder('test_file.txt", "E") charnum - >> charnum = character_finder('test_file.txt", ") charnum= >> charnum - character_finder('test_file.txt','*) charnum= 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started