C# Programming
08-04-2009, 09:05 AM
I have not yet manipulated text files so I need some help performing the following tasks:
1. I need to access a letter in a name (eg the 'h' in John)
2. I also need to find the name's position in a list of names (eg Joey is in position 3 here: John, Sally, Joey, Paul)
3. Finally I need to find the length (number of letters) of a name (eg the lenth of Paul is 4)
I am not limited to System.IO, but I am assuming that is the namespace that should be used for these tasks, so if one of these tasks require something not is System.IO then please tell me.
Edit:
The names are in "name1", "name2", "name3" format in the textfile. This might make things easier.
Edit 2:
Never mind I already got it. The trick is to store the file as a string and use the methods in the IEnumerator class.
modified on Tuesday, August 4, 2009 12:53 AM
1. I need to access a letter in a name (eg the 'h' in John)
2. I also need to find the name's position in a list of names (eg Joey is in position 3 here: John, Sally, Joey, Paul)
3. Finally I need to find the length (number of letters) of a name (eg the lenth of Paul is 4)
I am not limited to System.IO, but I am assuming that is the namespace that should be used for these tasks, so if one of these tasks require something not is System.IO then please tell me.
Edit:
The names are in "name1", "name2", "name3" format in the textfile. This might make things easier.
Edit 2:
Never mind I already got it. The trick is to store the file as a string and use the methods in the IEnumerator class.
modified on Tuesday, August 4, 2009 12:53 AM