Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: tokenize string Pin
ABitSmart9-Feb-09 16:13
ABitSmart9-Feb-09 16:13 
AnswerRe: tokenize string Pin
ABitSmart9-Feb-09 15:20
ABitSmart9-Feb-09 15:20 
GeneralRe: tokenize string Pin
lawrenceinba9-Feb-09 15:26
lawrenceinba9-Feb-09 15:26 
QuestionAny one use LibCheck or know of an alternative Pin
pdohara9-Feb-09 12:25
pdohara9-Feb-09 12:25 
AnswerRe: Any one use LibCheck or know of an alternative Pin
lawrenceinba9-Feb-09 14:40
lawrenceinba9-Feb-09 14:40 
GeneralRe: Any one use LibCheck or know of an alternative Pin
pdohara11-Feb-09 8:24
pdohara11-Feb-09 8:24 
AnswerRe: Any one use LibCheck or know of an alternative Pin
pdohara14-Feb-09 9:40
pdohara14-Feb-09 9:40 
Questionpassing arrays to different methods Pin
alwaysthinking9-Feb-09 12:10
alwaysthinking9-Feb-09 12:10 
Hey, I have created an array by reading in information from a text file and parsing it. The information follows different patterns and are difficult to parse completely in one go. However there are repeating patterns with keywords that I can use to set up different grammar structures such as line type (each different type of line starts with A,B,C,D, or E. I would like to use something like <if array ="A" then call AGrammarStructure> but I have no idea how to pass the rest of the array on to the method. Even then if i get that far, how do i say stop to the AGrammarStructure and move back to the original comparison?



This is my code so far, its all experimental so doesnt do a lot:
static void Main(string[] args)
{
string filename;
//This just allows me to change file name with different structures
do
{
Console.WriteLine("enter filename ");
filename = Console.ReadLine();

//calls the parsing method
//args inlcluded cause i cant use filestream without
parse(args, filename);
}
while (filename != "STOP");

static void parse(string[] args, string filenameload)
{

char[] delimiterChars = { ',' }; //set parse parameters
string fileextenstion = ("e:\\" + filenameload + ".txt");

//Opens the log file
FileStream file = new FileStream(fileextenstion
, FileMode.OpenOrCreate, FileAccess.Read);

//Reads in
StreamReader sr = new StreamReader(file);

string readlength = sr.ReadToEnd();
string Text = readlength;
sr.Close();
file.Close();

string[] words = Text.Split(delimiterChars); //parse contents
FileStream endfile = new FileStream("e:\\endfile.txt", fileMode.OpenOrCreate, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(endfile);

if (words[1] == "A")
Console.WriteLine("AGRAMMAR");
if (words[1] == "B")
Console.WriteLine("AGRAMMAR");
AnswerRe: passing arrays to different methods Pin
harold aptroot9-Feb-09 12:22
harold aptroot9-Feb-09 12:22 
GeneralRe: passing arrays to different methods Pin
alwaysthinking9-Feb-09 12:42
alwaysthinking9-Feb-09 12:42 
GeneralRe: passing arrays to different methods Pin
harold aptroot9-Feb-09 14:13
harold aptroot9-Feb-09 14:13 
AnswerRe: passing arrays to different methods Pin
Natza Mitzi9-Feb-09 12:41
Natza Mitzi9-Feb-09 12:41 
QuestionWebform and refresh Pin
Saamir9-Feb-09 11:53
Saamir9-Feb-09 11:53 
AnswerRe: Webform and refresh Pin
vaghelabhavesh9-Feb-09 13:53
vaghelabhavesh9-Feb-09 13:53 
AnswerRe: Webform and refresh Pin
EliottA9-Feb-09 14:02
EliottA9-Feb-09 14:02 
Question[Message Deleted] Pin
Terick9-Feb-09 11:48
Terick9-Feb-09 11:48 
AnswerRe: DropDownList selection as QueryInput Pin
vaghelabhavesh9-Feb-09 14:02
vaghelabhavesh9-Feb-09 14:02 
GeneralRe: DropDownList selection as QueryInput Pin
Terick10-Feb-09 4:37
Terick10-Feb-09 4:37 
GeneralRe: DropDownList selection as QueryInput Pin
vaghelabhavesh10-Feb-09 5:41
vaghelabhavesh10-Feb-09 5:41 
QuestionQuick Question Pin
MrMcIntyre9-Feb-09 10:40
MrMcIntyre9-Feb-09 10:40 
AnswerRe: Quick Question Pin
DaveyM699-Feb-09 10:48
professionalDaveyM699-Feb-09 10:48 
GeneralRe: Quick Question Pin
MrMcIntyre9-Feb-09 11:12
MrMcIntyre9-Feb-09 11:12 
GeneralRe: Quick Question Pin
DaveyM699-Feb-09 11:20
professionalDaveyM699-Feb-09 11:20 
GeneralRe: Quick Question Pin
MrMcIntyre9-Feb-09 11:50
MrMcIntyre9-Feb-09 11:50 
GeneralRe: Quick Question Pin
Dave Kreskowiak9-Feb-09 12:09
mveDave Kreskowiak9-Feb-09 12:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.