Thread: Getting a substring help plz

  1. #1
    Registered User
    Join Date
    Oct 2005

    Getting a substring help plz

    My assignment is to get a substring from a string called *src. The substring may be chars, words, items, fields, or records as determined by delims.

    First off, im not sure how to "get" a substring from another string. secondly, i know what a char is, but i dont know how to get words, items, or fields. Third, whats a delim?

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Oregon, USA
    whats a delim?

    im not sure how to "get" a substring from another string.
    Look at the strstr(), strchr() and strcpy() functions.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Join Date
    May 2004
    You can use strstr and strtok but wouldn't the whole point to the assignment be to write your own functions?

  4. #4
    Registered User
    Join Date
    Oct 2005
    Im pretty new a c but i guess you would just write a function that would loop through the char array (string) copy a section of the array. Obviously you would have to pass the string(array), starting point and ending point to split from and the size of the array .(or you could just pass one endPoint and copy from the start of the string to that point).

    I actually always had trouble returning a string because its and array. Im sure theres ways round this but usually i pass the array im going to return to aswell and put the value in there in the function.

    ie. instead of
    string = StrSplit(SplitMeString,startingPoint,endingPoint,s ize);
    StrSplit(SplitMeString,startingPoint,endingPoint,s ize,string)
    Last edited by fatdunky; 11-01-2005 at 05:16 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any1 plz make this assignment
    By jean in forum C Programming
    Replies: 17
    Last Post: 05-13-2009, 09:19 PM
  2. split string and remove substring
    By nyc_680 in forum C Programming
    Replies: 3
    Last Post: 03-02-2009, 03:45 AM
  3. I need help with creating a substring program
    By CProgramingBegg in forum C Programming
    Replies: 9
    Last Post: 02-06-2009, 08:50 AM
  4. Anyone plz help me
    By Rose_Flowers in forum A Brief History of
    Replies: 1
    Last Post: 09-17-2003, 12:01 PM
  5. help plz plz
    By nsssn73 in forum C++ Programming
    Replies: 2
    Last Post: 06-03-2002, 08:44 AM
Website Security Test