Results 1 to 3 of 3

Thread: [RESOLVED] split and replace using VC++ in MFC

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Resolved [RESOLVED] split and replace using VC++ in MFC

    Hi,

    I am a new in MFC applciation. I have a string "ABC-C_IF_2_6". First i find out the "-" and split two strings like ABC and C_1F_2_6. Second thing i need to replace comma (",") instead of underscore ("_") and my output look like C,1F,2,6 instead of C_1F_2_6. What is the function need to use these condition in vc++. How can we done it? In .net i can do using split function and replace the operator. How will do in vc++. If any option available, help me.
    It is very urgent.

    Hope your's reply.

    Thanks
    Failing to plan is Planning to fail

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: split and replace using VC++ in MFC

    Hi,

    Thanks for your reply. I got the code.

    CString s(_T(strClearanceValue));
    int i = s.Find(_T('-'));
    CString sLeft = s.Left(i);
    CString sRight = s.Right(s.GetLength() - i - 1);
    sRight.Replace(_T('_'), _T(','));


    It is working fine.

    Thanks
    Failing to plan is Planning to fail

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