Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: Editing strings in C#

Started 1 month, 2 weeks ago by andrestander
I am using Directory.GetFile() method to give me the list of all .txt files in my application path. Unfortunately it returns something like "C:/Document and setting/etc../lol.txt", the whole directory path with the file name and I cant display that on the listbox on my page. So, I thought I would make a For Loop that goes through each character in the string starting from right until it reaches...
Site: SitePoint : New Articles, Fresh Thinking for Web Developers and Designers  SitePoint : New Articles, Fresh Thinking for Web Developers and Designers - site profile
Forum: .NET  .NET - forum profile
Total authors: 5 authors
Total thread posts: 11 posts
Thread activity: no new posts during last week
Domain info for: sitepointforums.com

Other posts in this thread:

pufa replied 1 month, 2 weeks ago
look at the System.IO.Path class

pufa replied 1 month, 2 weeks ago
System.IO.Path.GetFileName(path)

pufa replied 1 month, 2 weeks ago
public IEnumerable<string> GetFiles(string path) { return Directory.GetFiles(path).Select(f => Path.GetFileName(f)); }

andrestander replied 1 month, 2 weeks ago
Thanks a lot pufa. 1 More questions though :P Is theres some sort of a website which has Net library explained and sorted under categories..? I mean, it would have been impossible to discover GetFileName() method by myself if you didn't introduce me to it, Moreover, to find methods in C# that formats/edits plain strings.

pufa replied 1 month, 2 weeks ago
Quote: Originally Posted by andrestander Is theres some sort of a website which has Net library explained and sorted under categories..? I mean, it would have been impossible to discover GetFileName() method by myself if you didn't introduce me to it, Moreover, to find methods in C# that formats/edits plain strings....

pufa replied 1 month, 2 weeks ago
Quote: Originally Posted by andrestander Moreover, to find methods in C# that formats/edits plain strings. string.Format("{0} {1}", 0 ,1); http://john-sheehan.com/blog/wp-cont...ng-strings. pdf

andrestander replied 1 month, 2 weeks ago
Thanks again Pufa. And I am using visual C# express with Microsoft's .net library :/

disgracian replied 1 month, 1 week ago
The namespaces are fairly well organised. Start from the MSDN class library ( http://msdn.microsoft.com/en-au/library/ms229335.a spx ) and just explore when the need arises. For text formatting & manipulation, you would probably notice the System.Text namespace. Also, since what you're formatting is a path, the System.IO namespace has a Path class. Cheers, D.

dzflip replied 1 month, 1 week ago
With files and directory, namespace System.IO is all you needed. You can find out it in MSDN.

progcompu replied 1 month, 1 week ago
What you could then do is go through all the files in a directory and all subdirectories using recursion

 

Top contributing authors

Name
Posts
pufa
5
user's latest post:
Editing strings in C#
Published (2009-11-12 03:17:00)
Quote: Originally Posted by andrestander Moreover, to find methods in C# that formats/edits plain strings. string.Format(&quot;{0} {1}&quot;, 0 ,1); http://john-sheehan.com/blog/wp-cont...ng-strings.pdf
andrestander
3
user's latest post:
Editing strings in C#
Published (2009-11-12 08:10:00)
Thanks again Pufa. And I am using visual C# express with Microsoft's .net library :/
disgracian
1
user's latest post:
Editing strings in C#
Published (2009-11-15 15:44:00)
The namespaces are fairly well organised. Start from the MSDN class library ( http://msdn.microsoft.com/en-au/library/ms229335.aspx ) and just explore when the need arises. For text formatting &amp; manipulation, you would probably notice the System.Text namespace. Also, since what you're formatting is a path, the System.IO namespace has a Path class. Cheers, D.
dzflip
1
user's latest post:
Editing strings in C#
Published (2009-11-16 02:37:00)
With files and directory, namespace System.IO is all you needed. You can find out it in MSDN.
progcompu
1
user's latest post:
Editing strings in C#
Published (2009-11-18 09:35:00)
What you could then do is go through all the files in a directory and all subdirectories using recursion

Related threads on "SitePoint : New Articles, Fresh Thinking for Web Developers and Designers":

Related threads on other sites:

Thread profile page for "Editing strings in C#" on http://www.sitepointforums.com. This report page is a snippet summary view from a single thread "Editing strings in C#", located on the Message Board at http://www.sitepointforums.com. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity