Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ()

image text in transcribed

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

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

Students also viewed these Databases questions