Parse RTF or Text Control into several lines including spaces


Author
Message
Michael Reese
Michael Reese
StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)StrataFrame User (403 reputation)
Group: StrataFrame Users
Posts: 235, Visits: 1.6K
Ok,



I need to read the textbox. Parse the contents into several lines each in the obx segment above. I will like to have it read the text object and set the line or row length and include carriage returns.



Thanks



Michael



Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
I must not be asking my questions properly because you aren't answering them and just keep saying the same things over and over again so I will bow out and let someone else take a shot at it.



Good luck. Smile



Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Michael,



Part of my confusion is why you are working on EDI out of a text box. I really don't know what part you are not getting either based on the comments on this thread so far.



So let me tell you what I generally do when working with EDI. In a very simple sample, the Split is an awesome feature and I will use it. However, when parsing EDI, it is generally best to create a reader. If you are reading out of a file, then I would create a FileStream then a StreamReader off of that file stream. You can also use a StringReader which would look something like this:





string line;

string[] segments;



System.IO.StringReader reader = new System.IO.StringReader(MyTextBox.Text);



line = reader.ReadLine();

while(!string.IsNullOrEmpty(line))

{

//-- Parse the line here. You may want to use a split at this point for segment delimitters (i.e. a pipe [|])

segments = line.Split(new char[] { '|' }, StringSplitOptions.None);



//-- Determine the segment type

switch(segments[0])

{

case "OBX":

{

//-- Place your OBX logic here

} break;

}



//-- Read the next line

line = reader.ReadLine();

}

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search