Question: Write a function insert() that takes three arguments: a character vector str1 [100], a character vector str2[100], and an integer i. Your function insert ()

 Write a function insert() that takes three arguments: a character vector

Write a function insert() that takes three arguments: a character vector str1 [100], a character vector str2[100], and an integer i. Your function insert () inserts the string str2 within string str1 after the ith element of str1 (i is > = 0). For example, if str1 = "abcd" and str2 = "123" and I = 0. after calling insert() the character vector str would contain "a123bcd". If str1 ="abcd" and str2 = "123" and I = 1, after calling insert() the character vector str would contain "ab123cd". Character vectors and str2 can hold strings of any length up to 99 characters. If the length of str1 after insterting str2 would be larger than 99, place the string "ERROR" in str1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!