Forum Discussion
HKosova
Alumni
8 years agoHere's another solution using a regular expression:
var str = "Hello how are you Hello, Hello, Hello. Hello"; var regexp = /Hello/g; var count = 0; var matches = str.match(regexp); if (matches != null) count = matches.length; Log.Message(count); // 5