Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I have a file that contains lines like this ...

Delphi
app_title_data = "This is the title of the application"
app_subtitle_data = "This is the subtitle"
; Comment goes here
app_content ="Content goes here"


I could retrieve the entire line using file reader...
I want to get the string inside double quotes for the specific keyword,,,
But I dont want to loop for each character,,, since the file may be very large...
Now I am using this code to split the keyword and value...

C#
string[] str = line.Trim().Split(new string[] { "=" }, StringSplitOptions.None);


Any suggestions ??
Posted

Do one thing concantanate each line of a string inside the loop while when reading the file using reader. from that result you can use the split function
C#
result.Split(new string[] { "=" }, StringSplitOptions.None);

Hope this helps
 
Share this answer
 
v2
Comments
Yesudasan Moses 20-Aug-13 3:19am    
Ting Ting Tidin,,,,
I could retrieve the entire line using file reader...
What I need is to get the exact string inside the quotes from a variable,,, :( without using a loop...
Yesudasan Moses 20-Aug-13 4:26am    
private static string GetActualValuefromText(string curval)
{
int fi = curval.IndexOf("\"", StringComparison.Ordinal);
if (fi != -1)
{
int la = curval.IndexOf("\"", fi + 1, StringComparison.Ordinal);
if (la != -1)
return curval.Substring(fi + 1, la - (fi + 1));
}
return "";
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900