You are on page 1of 1

# Private Function anka(ByVal maan As String) As Integer

## Dim buff(6) As Integer

If maan.Length < 2 Then
buff(0) = Convert.ToInt32(maan.Substring(0, 1))
buff(1) = Convert.ToInt32(maan.Substring(1, 1))
buff(2) = buff(0) + buff(1)
ElseIf maan.Length < 3 And maan.Length > 2 Then
buff(0) = Convert.ToInt32(maan.Substring(0, 1))
buff(1) = Convert.ToInt32(maan.Substring(1, 1))
buff(2) = buff(0) + buff(1)
Else
buff(0) = Convert.ToInt32(maan.Substring(0, 1))
buff(1) = Convert.ToInt32(maan.Substring(1, 1))
buff(4) = Convert.ToInt32(maan.Substring(2, 1))
buff(5) = Convert.ToInt32(maan.Substring(3, 1))
buff(2) = buff(0) + buff(1) + buff(4) + buff(5)
End If
If Convert.ToString(buff(2)).Length > 1 And Convert.ToString(buff(2)).Le
ngth < 3 Then
buff(3) = Convert.ToInt32(Convert.ToString(buff(2)).Substring(0, 1))
+ Convert.ToInt32(Convert.ToString(buff(2)).Substring(1, 1))
ElseIf Convert.ToString(buff(2)).Length > 2 And Convert.ToString(buff(2)
).Length < 5 Then
buff(3) = Convert.ToInt32(Convert.ToString(buff(2)).Substring(0, 1))
+ Convert.ToInt32(Convert.ToString(buff(2)).Substring(1, 1)) + Convert.ToInt32(
Convert.ToString(buff(2)).Substring(2, 1)) + Convert.ToInt32(Convert.ToString(bu
ff(2)).Substring(3, 1))
Else
buff(3) = buff(2)
End If
Return (buff(3))
End Function