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 8145849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:47:41+00:00 2026-06-06T13:47:41+00:00

I have variable WCHAR sDisplayName[1024]; How can I check if sDisplayName contains the string

  • 0

I have variable WCHAR sDisplayName[1024];

How can I check if sDisplayName contains the string “example”?

  • 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-06T13:47:42+00:00Added an answer on June 6, 2026 at 1:47 pm
    if(wcscmp(sDisplayName, L"example") == 0)
        ; //then it contains "example"
    else
        ; //it does not
    

    This does not cover the case where the string in sDisplayName starts with “example” or has “example” in the middle. For those cases, you can use wcsncmp and wcsstr.

    Also this check is case sensitive.

    Also this will break if sDisplayName contains garbage – i. e. is not null terminated.

    Consider using std::wstring instead. That’s the C++ way.

    EDIT: if you want to match the beginning of the string:

    if(wcsncmp(sDisplayName, L"Adobe", 5) == 0)
        //Starts with "Adobe"
    

    If you want to find the string in the middle

    if(wcsstr(sDisplayName, L"Adobe") != 0)
        //Contains "Adobe"
    

    Note that wcsstr returns nonzero if the string is found, unlike the rest.

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

Sidebar

Related Questions

I have variable LRowNode DBMS_XMLDOM.DOMNode; contains (example) <N_4883636> <TID_23787542>12</TID_23787542> <TID_23787543></TID_23787543> <TID_23787532/> <TID_23787533>0</TID_23787533> <TID_23787534/> <TID_23787535/>
I have variable x and I want to see if it contains a string
i have variable $lang which convert string to the selected language but i am
How I can have variable number of parameters in my function in C++. Analog
I have a variable coming into a stored procedure. This variable can either have
I have variable: String colorName = BLUE; I want to set this color to
We have variable $country , it can give ~50 different values. And variable $id
Suppose I have variable x in bash. How can I test if it's some
In a particular situation I need to have variable (character array or std:string) where
How can I add a variable to an array? Let say I have variable

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.