Cut String on first blank (space) with C# -
i'm new programming , can't find proper solution in c# this:
i cut string (from pslist) show in listbox
i running cmd command , export textfile - followed textfile being imported listbox.
currently listbox looks this:
http://img856.imageshack.us/img856/700/pnr1.jpg
the problem is, need name (or better pid(second collumn)) kill task pskill i'd need cut string either @ first number until next space, or if isn't possible first part first blank.
also i'm not able put textfile in columned listbox (due missing seperators in textfile, it's bunch of blanks seperating columns) can't access correct column. maybe easiest put textfile in proper columned listbox i'd need hint there...
thank help!
code pskillmethod is:
commandbuild("pslist", parameter: "> " + system.io.path.gettemppath() + "plist.txt"); string[] pslistarray = system.io.file.readalllines(@system.io.path.gettemppath() + "plist.txt"); listboxoutput pslistoutput = new listboxoutput(pslistarray); pslistoutput.setlabel("select task kill"); pslistoutput.setbtnvisible(true); pslistoutput.show();
have tried string.split mentioned in comments?
var psrowelements = pslistarray[i].split(new char[] {' '}, stringsplitoptions.removeemptyentries);
Comments
Post a Comment