CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2001
    Location
    New Jersey
    Posts
    312

    simple CString question...

    I have a string that comes in. When it comes it I dont care how big.

    After that I need to make the string only 10 characters long
    How do I force a CString to ditch all the letters after the 10th one.
    http://www.dewgames.com
    Shareware and Free games!

  2. #2
    Join Date
    Nov 2002
    Posts
    110
    Try this :


    CString szText = "abcdefghijklmn...";

    if(szText.GetLength() > 10)
    szText = szText.Left(10);

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