Reputation: 11
For example I have the school year 2012-2013. I only want to get the "2013" same goes as school year 2016-2017 I only want "2017". Can anyone help me? i Know this is easy. But I dont have any idea on how. Thanks in advance
Upvotes: 0
Views: 100
Reputation: 31
If your school year data is all consistent you could use the
String.Substring(int, int)
method. https://msdn.microsoft.com/en-us/library/aka44szs(v=vs.110).aspx
Ex:
dim String schoolYear = "2012-2014"
schoolYear.Substring(5,4)
Should return 2014
Upvotes: 0
Reputation: 3239
Let say you have
Dim String str = "2012-2013"
Then by using String.Split()
:
Dim strArr() As String
strArr = str.Split("-")
With strArr
you will have:
'strArr(0) = "2012"`
'strArr(1) = "2013"
Upvotes: 1