|
I have no idea what you're asking -- but try a Regular Expression.
|
|
|
|
|
It is difficult to work out exactly what you need. Is the input data in a fixed format? I.e. are the sections you need as separate strings always in the same place but within different strings? If so, then use String.Substring[^] - the second form will allow you to select the start position and length of each individual string.
If they aren't in fixed columns, then you either need to establish lead-in and tail-out sequences and then use a regular expression, or manually parse the string character by character to extract the data.
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
It is basically comes in this structure but the length of the strings changes.
i can regex the date as (\d{1,2}\-\d{1,2}\-\d{1,2}) and time (\d{1,2}\:\d{1,2}\:\d{1,2}\:\d{1,2})
but the others are a bit challenge .
|
|
|
|
|
But it seems you want
(ignore whitespace)
The first contiguous series
(ignore whitespace)
Everything before the date
(ignore whitespace)
The date
(ignore whitespace)
The time
(ignore whitespace)
Everything else
(ignore whitespace)
That's not difficult; download Expresso or try my RegexTester[^].
|
|
|
|
|
Thanks for the advices i am going to look at them
|
|
|
|
|
Have you looked at String.Split() using ">" and "<" as separators?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
the string comes as
r1
5ADW_DWDW:002311S HAKEJH IIEAZ TEENK H TGESA ST/SP STDTE
13-23-33 14:01:39:1 RUN FTTTR ALM r0
i only define the parts that i want.
|
|
|
|
|
OK, so how do you know where the substrings that you want start and end?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I know it .
I didn't wrote the right text this is similar to the right one.
|
|
|
|
|
????
First, determine what rule you use to separate (parse) the text into substrings. Once you can tell us that, then we can help you put together some code that will do it. Usually, once you know what the parsing rule is, the code is trivial.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
It seems you want to offer your help at the easier part of the job then.
|
|
|
|
|
Yeah, I'm pretty good at easy things!
I could conjecture on splitting at line breaks, then on long sequences of spaces or things that look like dates and times, but if the OP doesn't know that, then I don't see any way to parse the strings.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
sir, I want to create a blog for student blog for recruitment.I want to code to create.
So,please help me sir.
Thanks
in Advance.
|
|
|
|
|
Read the FAQs, look at all the responses to requests for code, then understand why I voted 1. A request for me to do your work for you, no matter how politely put, is still just that.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
First of all I actually don't understand what it is you're asking for.
Second of all, neither me or anyone else in here is gonna do it for you.
|
|
|
|
|
|
I want to make an application consisting of text boxes, radio buttons and check buttons. I did it in visual basic.
But i want to know that is there is any difference between what we program in Code Blocks and in Visual C ?
|
|
|
|
|
1) The title has nothing to do with C#
2) The question makes no sense at all
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
This is one funny question. But let me be a bit generous here.
What you create in VB can be done in C#.
Visual C# is same as C# with the visual content framework available to you for designing. The coding happens in C# only.
Yes all the code blocks are similar as in any other language but the syntax changes.
|
|
|
|
|
You know something? I bet Mark already knows this seeing that he's a regular contributor on the forums. Perhaps you meant to direct this particular nugget to the OP instead.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Ofcourse I know Mark knows it.
I just thought that this poor guy may have no info at al about CP. by the kind of question he asked, I guess it must be his first time or second... I had a similar impression when i came to CP for the first time. It took me a while to start loving it. and today, i have more than 10-12 rss feeds of different forums.
|
|
|
|
|
Hi guy.
C is the programming language. Visual C is the developing tools of Microsoft, person uses the VC to make the C program.
|
|
|
|
|
Hello!
I am trying to understand more about threading but i can't find how to 'free' the UI from the threads working in the background. How can i use my form's controls or move/resize the window while a progressbar is updated from a loop in another thread?
Here is the code:
delegate void _delegate();
private void button1_Click(object sender, EventArgs e)
{
Thread t1 = new Thread(new ThreadStart(ProgressUpdate));
t1.Start();
}
void ProgressUpdate()
{
if (progressBar1.InvokeRequired)
{
progressBar1.Invoke(new _delegate(Progress));
}
else
{
for (int i = 1; i <= 100; i++)
{
progressBar1.Value = (i * 100) / 100;
Thread.Sleep(50);
}
}
}
void Progress()
{
for (int i = 1; i <= 100; i++)
{
progressBar1.Value = i;
Thread.Sleep(50);
}
}
|
|
|
|
|
you got it wrong.
Having Control.InvokeRequired and Control.Invoke the way you did is just fine, however they cause the else block in ProgressUpdate to execute on the GUI thread (that was the intention all along), so that else block should NOT contain lengthy operations nor calls to Thread.Sleep
You should perform all timing by:
- using timers;
- OR using whatever you like on YOUR threads;
- but not by using Thread.Sleep on the GUI thread.
So a better approach would be to have the thread execute some method, say Progress, which contains any delay you like, and calls ProgressUpdate (the new one without any Sleep) to update the GUI.
|
|
|
|
|
The easiest way to multithread in a WinForms application is by using a BackgroundWorker. With it, you don't need to worry about InvokeRequired and Control.Invoke, it takes care of this for you. You can get more details on the MSDN website (http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]) , but below is a simple example.
private void button1_Click(object sender, EventArgs e)
{
BackgroundWorker worker = new BackgroundWorker();
worker.WorkerReportsProgress = true;
worker.WorkerSupportsCancellation = true;
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.RunWorkerAsync();
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show(e.Error.Message);
}
else if (e.Cancelled)
{
}
else
{
}
}
void worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
void worker_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = (BackgroundWorker)sender;
for (int i = 1; i <= 100; i++)
{
if (!worker.CancellationPending)
{
Thread.Sleep(50);
worker.ReportProgress(i);
}
else
{
e.Cancel = true;
break;
}
}
}
|
|
|
|