How to get a part of a string from a point onwards

This is a discussion on How to get a part of a string from a point onwards within the C Programming forums, part of the General Programming Boards category; Hey all, I've been trying to think of a way to extract a part of a string from a position ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    10

    Question How to get a part of a string from a point onwards

    Hey all,

    I've been trying to think of a way to extract a part of a string from a position to the end of the string, and I can't figure out how.
    For example

    Zthis is is the part of the string i want not including the first letter

    so, i need to extract the whole sentence, without Z and store it in a variable.
    How do i do this?

    Thanks

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,803
    I've been trying to think of a way to extract a part of a string from a position to the end of the string, and I can't figure out how.
    You can use say, strcpy(dest, source + n), where n is the position.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    10
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. String and Floating Point Conversion Help
    By dfghjk in forum C++ Programming
    Replies: 14
    Last Post: 05-04-2008, 12:11 PM
  2. String issues
    By The_professor in forum C++ Programming
    Replies: 7
    Last Post: 06-12-2007, 09:11 AM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  4. Program using classes - keeps crashing
    By webren in forum C++ Programming
    Replies: 4
    Last Post: 09-16-2005, 03:58 PM
  5. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM

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