CString Objects & subString :: MFC

This is a discussion on CString Objects & subString :: MFC within the Windows Programming forums, part of the Platform Specific Boards category; Hi. Is there a function to get a substring of a CString object? I can use GetAt() in a loop. ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    CString Objects & subString :: MFC

    Hi.

    Is there a function to get a substring of a CString object? I can use GetAt() in a loop. Nonetheless, I was wondering if there is a function specifically for accessing a substring of a CString object similar to an STL string object.

    Thanks,
    Kuphryn

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    You can use the Left, Mid and Right functions (like the basic VB functions) to get a sub string.

    CString s("Monster");
    Cstring r = s.Mid( 2, 3 ); /* "nst" */

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Nice! Thanks.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Substring a CString
    By geek@02 in forum Windows Programming
    Replies: 4
    Last Post: 08-17-2007, 08:57 AM
  2. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  3. Help with CString class and operator+ overloading
    By skanxalot in forum C++ Programming
    Replies: 2
    Last Post: 10-07-2003, 10:23 AM
  4. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  5. MFC:: CString & Serialize ::C++
    By kuphryn in forum C++ Programming
    Replies: 0
    Last Post: 02-22-2002, 02:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21