I want to slipt the following data ....
189{405.7}25{406.7}1{409.7}2{1.7}909<02.01.138.000 .9>{0.11}532756{401.7}2{402.7}0{403.7}1{404.12}185 .2{405.7}25{406.7}1{409.7}3{1.7}909<02.01.138.000. 9>{0.11}532756{401.7}2{402.7}1{403.7}1{404.12}191{ 405.7}50{406.7}1{409.7}3{1.7}909<02.01.138.000.9>{ 0.11}532756{401.7}2{402.7}0{403.7}1{404.12}185.1{4 05.7}10{406.7}1{409.7}4{1.7}909<02.01.138.000.9>{0 .11}532756{401.7}2{402.7}1{403.7}1{404.12}191.8{40 5.7}500{406.7}1{409.7}4{1.7}909...
12 1424
Hi,
use "Split" function..
Regards
Veena
Hi,
With which key word you want to split the text.
Did you want to split the text after every . or { or text between them.
GOOD LUCK
ALI
hi priyanka
try this code
Const a = "189{405.7}25{406.7}1{409.7}2{1.7}909<02.01.138.00 0.9>{0.11}532756{401.7}2{402.7}0{403.7}1{404.12}18 5.2{ 405.7}25{406.7}1{409.7}3{1.7}909<02.01.138.000.9>{ 0.11}532756{401.7}2{402.7}1{403.7}1{404.12}191{40 5.7}50{406.7}1{409.7}3{1.7}909<02.01.138.000.9>{0. 11}532756{401.7}2{402.7}0{403.7}1{404.12}185.1{ 405.7}10{406.7}1{409.7}4{1.7}909<02.01.138.000.9>{ 0.11}532756{401.7}2{402.7}1{403.7}1{404.12}191.8{ 405.7}500{406.7}1{409.7}4{1.7}"
Dim varBFR
Dim varBFR1
Dim varBFR2
varBFR = Split(a, ">")
Dim i As Integer
Dim ii As Integer
Dim iii As Integer
For i = 0 To UBound(varBFR)
varBFR1 = Split(varBFR(i), "<")
For ii = 0 To UBound(varBFR1)
varBFR2 = Split(varBFR1(ii), "}")
For iii = 0 To UBound(varBFR2)
Debug.Print varBFR2(iii) & IIf(InStr(1, varBFR2(iii), "{", vbTextCompare) > 0, "}", "")
Next
Next
Next
regards
manpreet singh dhillon hoshiarpur
Hey thanks guys actually this data save in text file n i have to crunch the data
From following data i want to retrive the values like
"189{405.7}25{406.7}1{409.7}2{1.7}909<02.01.138.00 0.9>{0.11}532756{401.7}2{402.7}0{403.7}1{404.12}18 5.2{ 405.7}25{406.7}1{409.7}3{1.7}
189
25
1
2
909
532756
2
0....
so on
Thank you
please help its urgent
hi priyanka
try following code
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.OpenTextFile("F:\Documents and Settings\XPPRESP3\My Documents\1.txt")
Dim varBFR
While Not ts.AtEndOfStream
varBFR = Split(ts.ReadLine, "}")
Dim i As Integer
For i = 0 To UBound(varBFR)
Debug.Print Val(varBFR(i))
Next
Wend
regards
manpreet singh dhillon hoshiarpur
Hey thanks manpreet, but it is giving error " complier error" near Set ts = fso.OpenTextFile("C:\rawdata.txt").....help me please
hi priyanka
add refererence to Microsoft Scripting Runtime. to do this open Project Menu and select Reference option
regards
manpreet singh dhillon hoshiarpur
m attaching the text file just check withy dat
hey but its not provide the proper values...
Hi Priyanka,
use this code:
Add a ListBox Control to ur Form and Check: -
Dim MyStr As String
-
Dim TArr
-
Dim i As Long
-
Dim j As Long
-
Dim TempStr As String
-
'
-
List1.Clear
-
MyStr = "189{405.7}25{406.7}1{409.7}2{1.7}909<02.01.138.000.9>{0.11}532756{401.7}2{402.7}0{403.7}1{404.12}185.2{ 405.7}25{406.7}1{409.7}3{1.7}"
-
TArr = Split(MyStr, "}")
-
For i = LBound(TArr) To UBound(TArr)
-
Dim NewArr
-
TempStr = TArr(i)
-
If Trim(TempStr) <> "" Then
-
NewArr = Split(TempStr, "{")
-
List1.AddItem NewArr(0)
-
End If
-
Next
-
MsgBox "Over"
-
Regards
Veena
Hi Priyanka
I am just suggesting the logic. I don't know what values you are expecting. I tried the file you sent, but no error was produced by the code. Because first few lines in the file cannot be used to extract values I have changed the code as follows: - Dim fso As New FileSystemObject
-
Dim ts As TextStream
-
Set ts = fso.OpenTextFile("F:\Documents and Settings\XPPRESP3\My Documents\rawdata1.txt")
-
Dim varBFR
-
Dim i As Integer
-
Dim strString As String
-
While Not ts.AtEndOfStream
-
strString = ts.ReadLine
-
If InStr(1, strString, "}", vbTextCompare) > 0 Then
-
varBFR = Split(strString, "}")
-
For i = 0 To UBound(varBFR)
-
Debug.Print Val(varBFR(i))
-
Next
-
End If
-
Wend
But this does not mean that this code will give the actual result you require. This is just to explain the logic. You have to modify the code according to your requirements.
Don't test large files in the debug window. You must create a breakpoint and check each value of varBFR(i) and then decide what to do with it.
Regards,
manpreet singh dhillon hoshiarpur
Hey thanks...now I want to add that data in database... any ideas?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: qwweeeit |
last post by:
The standard split() can use only one delimiter. To split a text file
into words you need multiple delimiters like blank, punctuation, math
signs (+-*/), parenteses and so on.
I didn't...
|
by: Christine |
last post by:
My code has a split function that should split the text file of numbers.
I've run this in previous programs as it is here and it worked, but now it
wont work for some reason and returns...
|
by: TJ |
last post by:
I am very new to C# (this is my first real project), therefore please be
patient if my question is considered being to newbie.
I am modifying a program which takes a text file, does some...
|
by: Krish |
last post by:
I have requirement, that i get one big chunk of text file. This text file
will have has information, that on finding "****End of Information****", i
have to split them individual text file with our...
|
by: Ben |
last post by:
Hi
I am creating a dynamic function to return a two dimensional array from a
delimeted string.
The delimited string is like:
field1...field2...field3...
field1...field2...field3......
|
by: edoardo.poeta |
last post by:
I'm a dummy. I have a basic knowledge of javascript and I want to split
a string, but I receive an error at line 15. Where my error in make the
array? Why? Can someone help me to resolve? Thank's....
|
by: garyusenet |
last post by:
I'm working on a data file and can't find any common delimmiters in the
file to indicate the end of one row of data and the start of the next.
Rows are not on individual lines but run accross...
|
by: garyusenet |
last post by:
string lines = File.ReadAllLines(@"c:\text\history.txt");
foreach (string s in lines)
{
ArrayList results = new ArrayList();
string delimit = ";";
string currentline = s.Split(";");
...
|
by: ivan.perak |
last post by:
Hello,
im a beginner in VB.NET... The thing i would like to do is as it
follows....
I have a text file (list of names, every name to the next line) which
is about 350000 lines long. I would...
|
by: AMP |
last post by:
Hello,
I am trying to split a string at the newline and this doesnt work:
String Channel = FileName.Split("\r");
What am I doing wrong?
Thanks
Mike
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |