Results 1 to 3 of 3

Thread: Replace characters in a char array

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Replace characters in a char array

    How do I replace character's in a char array. I have tried using the STD namespace and that doesent seem to be working. Can anyone help me?

  2. #2
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Replace characters in a char array

    Use the STL replace:
    Code:
    char[] str = "i like vb";
    replace( str, str+strlen(str), ' ', '' );
    cout << str;
    My C++ is a little rusty.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    493

    Re: Replace characters in a char array

    Quote Originally Posted by Zach_VB6 View Post
    Use the STL replace:
    Code:
    char[] str = "i like vb";
    replace( str, str+strlen(str), ' ', '' );
    cout << str;
    My C++ is a little rusty.
    Thanks man! But I happend to get it by just using 'erase();', +REP for helping though.

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