CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 1999
    Posts
    183

    How Do I Get Certain part of a string?

    i am trying to get windows text in c++, i need to get the windows text and then extract certain part as my string such as: my name is raj, now here i need the part "raj" how do i do that in vc++?



  2. #2
    Join Date
    Jun 1999
    Location
    Canada Qu颥c
    Posts
    59

    Re: How Do I Get Certain part of a string?

    If the text that you want to get is in a CString,
    you just have to look in the (Class Member ) of the CString class
    and you will find the function that you need or you can try

    char buffer[4];

    char name[] = "raj name";

    int a;

    for (a=0; a<3; a++)
    {
    buffer[a] = name[a];
    }

    I'm tired and i'm not sure if the best for this is for or while.

    Serge Gagnon



  3. #3
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793

    Re: How Do I Get Certain part of a string?

    Hi.
    CSring as memer 2 functions thatyou can use for this case:
    ine if CString::Find and the second is CString::GetAt(int Position);

    the first will find some char inside this string.
    the second will retrive the current char that place in this position.

    HTH
    kishk91

    [email protected]
    http://www.path.co.il
    ICQ: 13610258

  4. #4
    Guest

    Re: How Do I Get Certain part of a string?

    Use CString member functions Mid,Left and Right to extract part of a string.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured