obtaining data from string.
obtaining data from string.
(OP)
Hi, i am newin this. can you help me on this problem? I am trying to capture a string of data seperated by ":". is this coding correct? else please help.
text of string to capture:
12:Ian Richards:Africa:33 Beach Street:Hervey Bay:4655:(07)4567 8901
34:Yan Li:Secret:13 Mockingbird Lane:Mysteryville:7654:(03)2345 6789
coding:
fscanf(fptr, "%2s %c %[^\:] %c %[^\:]%*[^\:]%*c %c %[^\:] %c %[^\:] %c %[^\n]\n", newPtr->id,o, newPtr->name,o, newPtr->password,o, newPtr->address,o, newPtr->code,o, newPtr->phone);
o is use to capture the ":".
please help.
text of string to capture:
12:Ian Richards:Africa:33 Beach Street:Hervey Bay:4655:(07)4567 8901
34:Yan Li:Secret:13 Mockingbird Lane:Mysteryville:7654:(03)2345 6789
coding:
fscanf(fptr, "%2s %c %[^\:] %c %[^\:]%*[^\:]%*c %c %[^\:] %c %[^\:] %c %[^\n]\n", newPtr->id,o, newPtr->name,o, newPtr->password,o, newPtr->address,o, newPtr->code,o, newPtr->phone);
o is use to capture the ":".
please help.





RE: obtaining data from string.
Dim linString As String
Dim linVal() As String
linString = 'enter the string you want here...
linVal = linString.Split(":") 'where : = delimiter
linVal will be a string array that you can process further as you see fit
RE: obtaining data from string.
TiL