|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > File I/O and String Manupulation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|