TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gopi Asai
NA
331
0
Split the string and stored into array
Aug 11 2012 2:40 AM
Hi Friends,
I want to split the string after read from INI file. Below is my code.
I have read the line from INI file that which contain the keyword "ABC" at the starting position. Here i want to read the element of ABC that "i,a,s". I can able to read this but the first value shows along with the keyword "ABC". I don't want this. I need only the values. Could anyone help me.
string line;
string charname = string.Empty;
StreamReader file = new
System.IO.StreamReader(@"H:\Dotnet Practice\INI\INI\bin\Debug\emp.ini");
{
while ((line = file.ReadLine()) != null)
{
if (line.StartsWith("ABC"))
{
//string[] fullName = line.Split('=');
// charname = fullName[1];
string[] splitcharname = line.Split(',');
foreach (string splitchar in splitcharname )
{
MessageBox.Show(splitchar);
// if (splitchar == textBox1.Text)
// {
// MessageBox.Show("not allowed");
// }
//break;
}
}
}
INI file input:
ABC=i,a,s
output should be:
i
a
s
Please help me
Regards,
Gopi A
Reply
Answers (
2
)
when how to write any word by button click in C#.net??
bind tree view and delete nodes and also in database