Guys
I would like your support on how to extract from a string the numbers and count the quantity of
Odd Numbers, Even Numbers, Prime Numbers.
The string can come this way with "-" as delimiter.
1-2-3-4-5-6-7-8-9-10-11-12-13-14-15
3-6-7-11-173-14
I would like your support on how to extract from a string the numbers and count the quantity of
Odd Numbers, Even Numbers, Prime Numbers.
The string can come this way with "-" as delimiter.
1-2-3-4-5-6-7-8-9-10-11-12-13-14-15
3-6-7-11-173-14
Code:
[COLOR=#0000cd]Public Function[/COLOR] MyUDF(strNumbers [COLOR=#0000cd]As String[/COLOR], returnType [COLOR=#0000cd]As Integer[/COLOR])[COLOR=#008000]
'1=Odd Numbers[/COLOR]
[COLOR=#008000] '2=Even Numbers[/COLOR]
[COLOR=#008000] '3=Prime Numbers[/COLOR]
[COLOR=#0000cd]Select Case[/COLOR] returnType
[COLOR=#0000cd]Case[/COLOR] 1
[COLOR=#008000] 'Will return the quantity of Odd numbers[/COLOR]
[COLOR=#0000cd]Case[/COLOR] 2
[COLOR=#008000] 'Will return the quantity of Even numbers[/COLOR]
[COLOR=#0000cd]Case[/COLOR] 3
[COLOR=#008000] 'Will return the quantity of Prime numbers[/COLOR]
[COLOR=#0000cd] End Select[/COLOR]
[COLOR=#0000cd]End Function[/COLOR]
Last edited: