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
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"
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.