String Line Manipulation
String Line Manipulation
String Line Manipulation
String Line Manipulation
String Line Manipulation
String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation
String Line Manipulation String Line Manipulation
String Line Manipulation
Go Back  Xtreme Visual Basic Talk > > > String Line Manipulation


Reply
 
Thread Tools Display Modes
  #1  
Old 07-17-2009, 04:54 PM
pnormoyle pnormoyle is offline
Newcomer
 
Join Date: Jul 2009
Posts: 9
Thumbs up String Line Manipulation


I thought you could use a structure as a container. I have line_1 with a line of data read in from a file. I only want to Look in position 1 of the line and position 8 for 9 and position 31 for 11.

If I create a line_2 with the parts broken out for pieces that I want to look at then I could use a with statement right?

I make line_1 equal to line_2 where I could have line_2 already sectioned out for parts 1,2, 3. Then use 1, 2 and 3?
How would I do that in vb.net?

Line 1 = 500 char
struct Line 2
part_1[1]
part_filler_1[7]
part_2[9]
part_filler_2[13]
part_3[11]
part_3[458]
end struct
then by doing "line_2 = line_1" I could use part_1, Part_2 and Part_3.

Is this correct or is there a better way. The alternative is to substring out all the parts I need.
Reply With Quote
  #2  
Old 07-17-2009, 08:43 PM
AtmaWeapon's Avatar
AtmaWeaponString Line Manipulation AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

I don't really understand what you are asking; are you asking if you can assign a string to a structure and have it magically treat parts of the line as variables in the structure? The answer to that is no, but you can make a class that simulates it. I'm not quite sure what you're asking though; could you clarify?
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 07-20-2009, 11:28 AM
pnormoyle pnormoyle is offline
Newcomer
 
Join Date: Jul 2009
Posts: 9
Default That's correct

No you are correct. Can you assign one string to a structure and treat the parts of the structure differently. Similar to how one might use UDT's from VB.6.
Reply With Quote
  #4  
Old 07-21-2009, 03:03 PM
AtmaWeapon's Avatar
AtmaWeaponString Line Manipulation AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

You can't directly do this, you'll have to write a method to split the string and save pieces of it into the relevant variables.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
String Line Manipulation
String Line Manipulation
String Line Manipulation String Line Manipulation
String Line Manipulation
String Line Manipulation
String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation String Line Manipulation
String Line Manipulation
String Line Manipulation
 
String Line Manipulation
String Line Manipulation
 
-->