+ Reply to Thread
Results 1 to 2 of 2

 

Thread: Removing Sub String

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts


    I want to remove a sub string from a string in C++
    How can i do this.
    Give me the algo only or tell me the logic for this program.

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Assuming you are using std::string then you can use the substr method:

    Code:
    #include <string>
    
    int main ()
    {
      std::string str="get the substring from this string";
    
      std::string str2 = str.substr (8,9); // "substring"
      ...

+ Reply to Thread


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP - String replacement
    By Northern Monkey in forum Programming
    Replies: 3
    Last Post: 13-08-06, 12:52 PM
  2. PHP String Function Remove Last X Chr of String
    By scifind in forum Programming
    Replies: 3
    Last Post: 08-07-05, 09:42 AM
  3. String Array
    By Chris Clarkson in forum Programming
    Replies: 2
    Last Post: 27-02-04, 06:26 PM
  4. Removing forward slashes / from a string in PHP
    By giveasyouget in forum Programming
    Replies: 6
    Last Post: 20-09-03, 12:06 AM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2