Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Inputs: (char) A sentence to be modified (char) The word to be replaced in the sentence (char) The word to replace with Outputs: 1. (char)

Inputs:

  1. (char) A sentence to be modified

  2. (char) The word to be replaced in the sentence

  3. (char) The word to replace with

Outputs:

1. (char) Modified sentence Banned Functions:

strrep()

Background:

The ctrlF and replace feature on your laptop is broken and you need to use MATLAB to do the job!

Function Description:

Your function will replace one word within your sentence with another, indicated by your input variables. Your output will be the entire modified sentence with the replaced word.

Example:

original = 'My favorite class is physics!'; wordFind = 'physics'; wordReplace = 'CS1371'; out = repWord(original, wordFind, wordReplace); out 'My favorite class is CS1371!'

Notes:

  • There will be exactly one instance of the word you will replace (it will not appear twice in a sentence)

  • Your function should be case sensitive (i.e. 'MATLAB' and 'matlab' are not the same)

    Hints:

  • The strfind() function will be useful!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Discuss the roles of metacognition in learning and remembering.

Answered: 1 week ago

Question

Comment should this MNE have a global LGBT policy? Why/ why not?

Answered: 1 week ago