Forum Discussion

amardeep2021's avatar
amardeep2021
New Contributor III
4 years ago

Need to identify count of a character appearance in a string

Hi all,

I have a scenario where upstream document has a string field like below. In this string ‘:’ can appear for some records. All I need to find is how many times ‘:’ appears in the string for each record to pass the count.

Eg:
fjhfjh:jfhjhgg:oueru:nvmcb
aklkl:pqooo:
pqos:jfh
akkk
uryt:jdf:cvmb

Expected count result:
3
2
1
0
2

I have tried with available find, contain, indexof expressions. Not suits for this scenario. Can someone have a better trick to find count of a character instances in a string? Kindly help.

Regards,
amardeep

3 Replies

No RepliesBe the first to reply