Results 1 to 2 of 2

Thread: Please Help V1.1

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    50

    Please Help V1.1

    Hello,

    Today i received my homework assignment for this week and i finished every question except one. The question is: "Write a Program that requests a word containing "r" and "n" as input and determines where the two letters appear first.

    Just wondering how i should approach this i need to use a loop somewhere but i am confused as to how or what sort of code i should use. I know there needs to be a index to find the letter i just don't know how to screen the word to look for r and n using a loop.

    Thanks
    Attached Images Attached Images  

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Please Help V1.1

    The String.IndexOf method will tell you whether a String contains a specific character or substring and, if it does, at what index it first appears. If you want to find all occurrences you can call IndexOf repeatedly, using the index of the previous occurrence to determine the start index for searching for the next. -1 is returned when the value isn't found.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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