Click to See Complete Forum and Search --> : Mid Function (Well i think it's a function) question
casparas
Jan 3rd, 2000, 05:52 AM
Hiuston i have a problem :)
I tried to make something with mid or mid$ functions but i failed.
My problem is that i have string "12.30.98" in my program and i need to get "30" from it with MID function (it's function right?)
Thanx
-Casparas
Gimpster
Jan 3rd, 2000, 06:05 AM
Well, the first thing you need to be sure of is that the date is ALWAYS in that format (MM.DD.YY). Otherwise this will not work. But as long as it's in that format then just do this:
Text1.Text = Mid(Text1.Text, 4, 2)
The way it works is like this. The first part of the Mid function is the string that you want to work with. The second part is the starting point. And the third part is the length.
------------------
Ryan
B4
Jan 3rd, 2000, 06:07 AM
To get the "30" out of "12.30.98" you would do this:
Mydata="12.30.98"
MyString = Mid(Mydata, 3, 2)
Mid has three parameters. The string you want to parse, the start, and how the length. You start at 3 because you don't want "12." including in the result, and you move for two, to get 30.
-B4
Gimpster
Jan 3rd, 2000, 07:25 AM
You would actually start at 4, not 3, because the "3" in 30, is the 4th letter of the string. The third letter of the string is the "."
------------------
Ryan
casparas
Jan 3rd, 2000, 07:51 PM
Reallly big thanx (At last my program works)
-Casparas
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.