hairsh
(yuvrajsingh)
#1
Hi,
My string contains multiple commas like this
625 State St., PO Box 2207
Schenectady**,** NY 123012207
and one more string contains single comma like this
PO Box 740801
Atlanta**,** GA 30374
How can i loop into the condition(if or else), if multiple commas it should be in one flow and other flow if it is a single comma?
Susana
(Susana González Cacheiro)
#2
Hello @hairsh,
Hope this could help you:
A quick solution could be using the following to get the number of commas:
int32 countCommas = yourstring.Count(Function(c As Char) c = “,”)
Thanks and best regards,
Susana
Another solution is
int count = yourString.Split(',').Length - 1
if count == 1 {}
if count > 1 {}
tmays
(Troy)
#5
Hi @hairsh,
On your split use (","c).
Cheers
Troy
You need to specify the character type like below -
int count = yourString.Split(","c).Length - 1
1 Like
system
(system)
closed
#7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.