Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 17th, 2004, 10:48 PM
alee7 alee7 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 alee7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question File I/O and String Manupulation

5241.1 To all VB PRogrammers

Need some kind asistance on coding on string manupulation and file I/O procedure i'm working on.

I 've a master file that i need to read and extract out all lines that contain the char ARC and output it to a new file.

However, the criteria for the extraction is to consider only lines that contains char ARC in 4 consecutive rows or in 8 consecutive rows ONLY. If there are 8 consecutive rows that contain the char "ARC" there should be another line above the first line and after the 4th line that holds the character COLOR X.

If there are 4 consecutive rows that contains the char "ARC" then there should be an additional above the first line that holds the char COLOR X.

example

Extract of Master file

; C3C3
CIRCLE 8.12875,7.35611 0.08990
; C3C6
ARC C 8.7924,7.28173 8.7924,7.11296 8.96118,7.28173
; C3C6
ARC C 8.7924,7.28173 8.96118,7.28173 8.7924,7.4505
; C3C6
ARC C 8.7924,7.28173 8.7924,7.4505 8.62363,7.28173
; C3C6
ARC C 8.7924,7.28173 8.62363,7.28173 8.7924,7.11296
; C3D1
CIRCLE 7.88413,6.33096 0.13690

;C3H3
ARC C 8.81774,2.61654 8.81774,2.78531 8.64897,2.61654
; C3H3
ARC C 8.81774,2.61654 8.81774,2.44776 8.98651,2.61654
; C3H3
ARC C 8.81774,2.61654 8.98651,2.61654 8.81774,2.78531
; C3H3
ARC C 8.81774,2.61654 8.64897,2.61654 8.81774,2.44776
; C3H6
ARC C 8.89212,2.28471 8.72334,2.28471 8.89212,2.11594
; C3H6
ARC C 8.89212,2.28471 8.89212,2.45349 8.72334,2.28471
; C3H6
ARC C 8.89212,2.28471 8.89212,2.11594 9.06089,2.28471
; C3H6
ARC C 8.89212,2.28471 9.06089,2.28471 8.89212,2.45349
; C4J1
CIRCLE 7.16923,2.13269 0.10952

---do not consider the 2 "ARC" lines below because it does not meet criteria.

; J3H1
ARC C 8.26843,2.36211 8.27096,2.41752 8.21293,2.36236
; J3H1
ARC C 8.26843,2.36424 8.21293,2.36236 8.27096,2.30882
; J3H1
LINE 8.54108,2.28267 8.54108,2.23772

Output expected.

---for 4 consecutive rows--

COLOR X
ARC C 8.7924,7.28173 8.7924,7.11296 8.96118,7.28173
ARC C 8.7924,7.28173 8.96118,7.28173 8.7924,7.4505
ARC C 8.7924,7.28173 8.7924,7.4505 8.62363,7.28173
ARC C 8.7924,7.28173 8.62363,7.28173 8.7924,7.11296


---- For 8 consecutive rows------

COLOR X
ARC C 8.81774,2.61654 8.81774,2.78531 8.64897,2.61654
ARC C 8.81774,2.61654 8.81774,2.44776 8.98651,2.61654
ARC C 8.81774,2.61654 8.98651,2.61654 8.81774,2.78531
ARC C 8.81774,2.61654 8.64897,2.61654 8.81774,2.44776
COLOR X
ARC C 8.89212,2.28471 8.72334,2.28471 8.89212,2.11594
ARC C 8.89212,2.28471 8.89212,2.45349 8.72334,2.28471
ARC C 8.89212,2.28471 8.89212,2.11594 9.06089,2.28471
ARC C 8.89212,2.28471 9.06089,2.28471 8.89212,2.45349


Hope someone can further assist.

Whatever help is much appreciated.



Thanks a million!

5241.1 To all VB PRogrammers

Need some kind asistance on some string manupulation and file I/O i'm working on.

I 've a master file that i need to read and extract out all lines that contain the char ARC and output it to a new file.

However, the criteria for the extraction is to consider only lines that contains char ARC in 4 consecutive rows or in 8 consecutive rows ONLY. If there are 8 consecutive rows that contain the char "ARC" there should be another line above the first line and after the 4th line that holds the character COLOR X.

If there are 4 consecutive rows that contains the char "ARC" then there should be an additional above the first line that holds the char COLOR X.

example

Extract of Master file

; C3C3
CIRCLE 8.12875,7.35611 0.08990
; C3C6
ARC C 8.7924,7.28173 8.7924,7.11296 8.96118,7.28173
; C3C6
ARC C 8.7924,7.28173 8.96118,7.28173 8.7924,7.4505
; C3C6
ARC C 8.7924,7.28173 8.7924,7.4505 8.62363,7.28173
; C3C6
ARC C 8.7924,7.28173 8.62363,7.28173 8.7924,7.11296
; C3D1
CIRCLE 7.88413,6.33096 0.13690

;C3H3
ARC C 8.81774,2.61654 8.81774,2.78531 8.64897,2.61654
; C3H3
ARC C 8.81774,2.61654 8.81774,2.44776 8.98651,2.61654
; C3H3
ARC C 8.81774,2.61654 8.98651,2.61654 8.81774,2.78531
; C3H3
ARC C 8.81774,2.61654 8.64897,2.61654 8.81774,2.44776
; C3H6
ARC C 8.89212,2.28471 8.72334,2.28471 8.89212,2.11594
; C3H6
ARC C 8.89212,2.28471 8.89212,2.45349 8.72334,2.28471
; C3H6
ARC C 8.89212,2.28471 8.89212,2.11594 9.06089,2.28471
; C3H6
ARC C 8.89212,2.28471 9.06089,2.28471 8.89212,2.45349
; C4J1
CIRCLE 7.16923,2.13269 0.10952

---do not consider the 2 "ARC" lines below because it does not meet criteria.

; J3H1
ARC C 8.26843,2.36211 8.27096,2.41752 8.21293,2.36236
; J3H1
ARC C 8.26843,2.36424 8.21293,2.36236 8.27096,2.30882
; J3H1
LINE 8.54108,2.28267 8.54108,2.23772

Output expected.

---for 4 consecutive rows--

COLOR X
ARC C 8.7924,7.28173 8.7924,7.11296 8.96118,7.28173
ARC C 8.7924,7.28173 8.96118,7.28173 8.7924,7.4505
ARC C 8.7924,7.28173 8.7924,7.4505 8.62363,7.28173
ARC C 8.7924,7.28173 8.62363,7.28173 8.7924,7.11296


---- For 8 consecutive rows------

COLOR X
ARC C 8.81774,2.61654 8.81774,2.78531 8.64897,2.61654
ARC C 8.81774,2.61654 8.81774,2.44776 8.98651,2.61654
ARC C 8.81774,2.61654 8.98651,2.61654 8.81774,2.78531
ARC C 8.81774,2.61654 8.64897,2.61654 8.81774,2.44776
COLOR X
ARC C 8.89212,2.28471 8.72334,2.28471 8.89212,2.11594
ARC C 8.89212,2.28471 8.89212,2.45349 8.72334,2.28471
ARC C 8.89212,2.28471 8.89212,2.11594 9.06089,2.28471
ARC C 8.89212,2.28471 9.06089,2.28471 8.89212,2.45349


Hope someone can further assist.

Whatever help is much appreciated.



Thanks a million!

Reply With Quote
  #2  
Old June 19th, 2004, 12:23 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 18 h 33 m 48 sec
Reputation Power: 180
What strange requirements! The overall design might warrant a revisit

You will have to write some code that opens your file and starts reading line by line and run validation tests as each line is read.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > File I/O and String Manupulation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway