Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Namespace MathUtility
- 'Module for identifying palindromic numbers.
- Public Module Palindrome
- 'Function for reversing string entries.
- Public Function Reverse(ByVal value As String) As String
- 'Returns the reversed string
- Return StrReverse(value)
- End Function
- 'Function for converting a numeric value to String.
- Public Function IntToString(ByVal value As Long) As String
- 'Returns a string of the numeric value.
- Return CStr(value)
- End Function
- 'Function for checking if the number is palindromic.
- Public Function IsPalindrome(value As Long) As Boolean
- 'Selects the valid case.
- Select Case True
- 'Case: if the reversed number = user input.
- Case value = Reverse(IntToString(value))
- 'Returns true.
- Return True
- 'Case: if the reversed number ≠ user input.
- Case Else
- 'Returns false.
- Return False
- End Select
- End Function
- End Module
- End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement