|
-
Nov 24th, 2002, 01:26 PM
#1
Thread Starter
yay gay
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?
\m/  \m/
-
Nov 24th, 2002, 01:42 PM
#2
Frenzied Member
System.Text.RegularExpression
Read on that.. Regex to be specific
-
Nov 24th, 2002, 01:42 PM
#3
Thread Starter
yay gay
\m/  \m/
-
Nov 24th, 2002, 01:47 PM
#4
Thread Starter
yay gay
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 =)
\m/  \m/
-
Nov 24th, 2002, 01:50 PM
#5
Thread Starter
yay gay
damn when trying in run-time it returned a System.IO.StreamReader...
\m/  \m/
-
Nov 24th, 2002, 01:55 PM
#6
Frenzied Member
-
Nov 24th, 2002, 01:57 PM
#7
Thread Starter
yay gay
nvm the problem was the string i was trying to split was saying that
\m/  \m/
-
Nov 24th, 2002, 02:10 PM
#8
Thread Starter
yay gay
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..?
\m/  \m/
-
Nov 24th, 2002, 02:18 PM
#9
PowerPoster
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");
}
-
Nov 24th, 2002, 02:21 PM
#10
Thread Starter
yay gay
the problem is the same...it isnt as string format
\m/  \m/
-
Nov 24th, 2002, 02:30 PM
#11
PowerPoster
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.
-
Nov 24th, 2002, 02:33 PM
#12
PowerPoster
//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);
-
Nov 24th, 2002, 02:35 PM
#13
Thread Starter
yay gay
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|