I have text for example:
11.12.2009 or 7.8.2004 and how to get three variables, a, b, c
a = 7
b = 8
c = 2004
Thanks!
Printable View
I have text for example:
11.12.2009 or 7.8.2004 and how to get three variables, a, b, c
a = 7
b = 8
c = 2004
Thanks!
Well, those sure look like dates, which offers up a couple methods. Since they are strings now, one thing you can do is to get the pieces directly with SubString, but that would get awkward since the dots can move around depending on whether the day and month are single or double digit. The better way to do this would be to convert to date using CDate (if you can be certain that they will always be dates, and Date.TryParse otherwise). You can then use the Month, Day, and Year properties to get those pieces from the date.
I don't understand. That's not a date (just look like date), this can be some other string (98.72.2941), code?
Look at splitting strings.
http://msdn.microsoft.com/en-us/libr...ing.split.aspx
Does somebody have code for this I ask. I know when I have two elements
split
string(0)
string(1)
and now with point???
Dim a As Integer = ""
Dim b As Integer = ""
Dim c As Integer = ""
Would this work? :S
Code:Dim test as string = "78.95.9646"
Dim splitString() as String
splitString()= test.split(".")
' At this point we have 3 strings in an array
Dim a, b, c as integer
a = CInt(splitstring(0))
b = CInt(splitstring(1))
c = CInt(splitstring(2))
Thank you Megalith! :)