My question is that HowCanISeperateThisSentence into words in C?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • endazyar
    New Member
    • Mar 2010
    • 11

    My question is that HowCanISeperateThisSentence into words in C?

    as it writes in the title how can seperate a sentence like that (AhmetAliMehmet ) into those words first = Ahmet, second = Ali, third = Mehmet,. I know that we have use string.h library and the function that copy a string strcpy.

    Thank you for ur attention.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Each word starts with a captial letter. So the word extends from there until one position less than tghe next captial letter. Use strncpy to copy out that range.

    Be sure to factor in the end of the string as a capital letter so you can get the last word.

    Method B:

    copy out letter one at time until you reach another capital letter or end of string. Whe you do, terminate the current word and start a new one.

    Comment

    • endazyar
      New Member
      • Mar 2010
      • 11

      #3
      thank you so much, i'll try in a short time and i'll let you know if i achieve it.

      Comment

      • endazyar
        New Member
        • Mar 2010
        • 11

        #4
        i'd like to say thank you again weaknessforcats . it works. Be good thick.

        Comment

        Working...