-
split function
i wanna split a string with the split functions by spliting by the "large" keyword...i tryed making
myString.Split("large");
and it didnt work..it says it needs an char array... i made one but he keeps only loooking for the 1st letter of the split string(in this case l)..what am i doin wrong?
-
System.Text.RegularExpression
Read on that.. Regex to be specific
-
-
i've asked myself what would mean the Regex.Split method when looking by info on msdn but never clicked in the link to that... lol
its workin like a sharm =)
-
damn when trying in run-time it returned a System.IO.StreamReader... :confused:
-
-
nvm the problem was the string i was trying to split was saying that
-
PHP Code:
string fileName = @"C:\Documents and Settings\JBRANCO\Desktop\dev.txt";
string lol = System.IO.File.OpenText(fileName).ToString();
MessageBox.Show(lol);
this is returning System.io.streamreader...what am i doin wrong? invalid cast maybe..?
-
Your going to want to do something like this:
Code:
string input = null;
// Open the file
try
{
System.IO.StreamReader re = System.IO.File.OpenText("YourFile");
// This will put the file as a string variable for you.
input = re.ReadToEnd();
// Close the streamreader.
re.Close();
}
catch
{
MessageBox.Show("File Problem");
}
-
the problem is the same...it isnt as string format
-
Did you do what I did in my post? If the file your opening is a text file, then use what I posted. When you use the OpenText method, it returns a streamreader. You then need to tell the streamreader to give you text. That is what this line does:
input = re.ReadToEnd();
input is a string variable.
-
//Check your file name and path, it looks incorrect to me
string fileName = @"C:Documents and Settings\JBRANCODesktopdev.txt";
string text;
StreamReader re = System.IO.File.OpenText(fileName);
text = re.ReadToEnd();
re.Close();
MessageBox.Show(text);
-