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

  • SEARCH
  • Home
  • 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 6469017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:56:40+00:00 2026-05-25T05:56:40+00:00

I am not good with c++ and I cannot find this anywhere, please apologize

  • 0

I am not good with c++ and I cannot find this anywhere, please apologize me if it is a bad question. I have a pointer and I want to know if some names store in this pointer begins with some specific string. As in python something like (maybe it is a bad example):

if 'Pre' in pointer_name:

This is what I have:

 double t = 0;
 for (size_t i =0; i < modules_.size(); ++i){
    if(module_[i].name() == "pre"){  // here is what I want to introduce the condition
        if (modules_[i].status() == 2){
            std::cout << module_[i].name() << "exists" << std::endl;
         }
    }
 } 
  • 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-05-25T05:56:41+00:00Added an answer on May 25, 2026 at 5:56 am

    The equivalent of Python 'Pre' in string_name is:

    string_name.find("Pre") != std::string::npos // if using string
    
    std::strstr(pointer_name, "Pre") // if using char*
    

    The equivalent of Python string_name.startswith('Pre') (“begins with some specific string”) is:

    string_name.size() >= 3 && std::equal(string_name.begin(), string_name.begin() + 3, "Pre"); // if using string
    
    string_name.find("Pre") == 0 // less efficient when it misses, but shorter
    
    std::strncmp(pointer_name, "Pre", 3) == 0 // if using char*
    

    In two of those cases, in practice, you might want to avoid using a literal 3 by measuring the string you’re searching for.

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

Sidebar

Related Questions

I feel stupid asking this question, but I can not find a clear answer
I have a few things that I cannot find a good way to perform
Just a quick question, on which I cannot find a good reference, especially with
After searching online for quite some time, I cannot find a good way to
I know this isn't a good question to ask and I might get cursed
I'm not good with JavaScript, and this is Google's code. I'm getting a object
I am not good at SQL Server 2000. I have a comma-delimited list of
Honestly I'm very bad at CSS and not good at dealing with color /
Original Question: i read that for RESTful websites. it is not good to use
this is a very specific question, but i also have very specific details on

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.