I have written a code where I need to get the number from a string like this: "3/1". I need to store those 2 numbers as integer in 2 different variables. I have written this code in 2 classes: This function is my split function in the class (BigOne)
Public Function SplitValues(pInput As String, pdelim As String) As String()
'Declaration of variables
Dim strSplit() As String
Dim countDelim As Integer
'Initialization of variables
countDelim = countCharacter(pInput, pdelim)
If countDelim > 0 Then
ReDim strSplit(countDelim)
strSplit = Split(pInput, pdelim)
SplitValues = strSplit
End If
End Function
In the main class I have a function calling to this function that splits the number to get the values that I want. However I am getting a "Type Mismatch error" I am not able to detect the reason of this type mismatch.
Public Function get_MaxChars(pInput As String) As Integer
'declaration of variables
Dim gen As cBigOne
Dim values As String
'Main code
pInput = CStr(pInput)
Debug.Print (pInput)
values = gen.SplitValues(pInput, "/")
get_MaxChars = CInt(values(0))
End Function
So, I am not able to see why it is not working correctly and I am getting the type mismatch error. Because, I believe that everywhere I am passing the same type.