Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8622701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:07:17+00:00 2026-06-12T07:07:17+00:00

I am having a problem. I need to make a function called replaceText that

  • 0

I am having a problem. I need to make a function called replaceText that replaces a targeted text with new text. The null character is not included and if no targetText is found then there is no text replacement.

The parameters are two arrays targetText[] and replacementText[]. This is for an assignment and I cannot use str. Here is my code so far.

void SimpleString::replaceText(char targetText[], char replacementText[])
    {
        for ( int i = 0; i < MAX_LIST; i++)
        {
            if( replacementText[i] > MAX_LIST)
            {
                throw SimpleStringOverflowException("SimpleStringOverflowException: Resulting SImpleString too large.");
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:07:18+00:00Added an answer on June 12, 2026 at 7:07 am

    Here you go:

        void replace_text(char targetText[], char replacementText[])
    
    {
    
    
        int i;
            if(strlen(replacementText) > 0 )
        {
    
            for(i=0;i<strlen(replacementText);i++)
            {           
                targetText[i] = replacementText[i];
            }
            for(i = strlen(replacementText) ; i < strlen (targetText) ; i++)
                targetText[i] = '\0';
        }
    
    } 
    

    I assume you can use strlen….right? if not let me know…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well basically, I'm having a problem, how to make a function in haskell to
I have a list of href / text that I need to make anchors
I need to make sure that some submitted code has a function named mapfn
I'm having an CSS problem, i need to achieve this article div#comments-wrapper ul.sub-comment:before {
Having problem with the middle Div not expanding to the width http://acs.graphicsmayhem.com/images/middiv.jpg Ok, how
I seem to be having a problem with a macro that I have defined
I'm new to Lua programming, having come over from python to basically make a
I'm having a problem in C++ with calling a function of a derived class
I have numerous functions that are called from a background thread, but then need
I need help in understanding the code snipped below...allocate is a function that would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.