Posts
Superscripts in VB
- Get link
- X
- Other Apps
Good Day Friends, I was working on how to calculate the position of students in a class and i got stocked. I did some research on line and i was unable to get the position of student so I left the code for three days. On the third day, i had a good rest and when i went back to my code, i decided to create a public sub, pass a variable to the sub that will determine the position and use the length of the position to get the superscripts . Below is a segment of my code in VB Public Sub GetSuffix(position As String) Dim suffix As String = "th" If Integer.Parse(position) < 11 OrElse Integer.Parse(position) > 20 Then position = position.ToCharArray()(position.ToCharArray().Length - 1).ToString() Select Case position Case "1" suffix = "st" Exit Select Case "2" suffix = "nd"