NUMBER OF OCCURRENCES OF A CHARACTER IN A STRING
************************************************************************
W.A.P TO CHECK THE NUMBER OF OCCURRENCES OF A CHARACTER IN A STRING
************************************************************************
REGEX MEANS REGULAR EXPRESSION
JAVA Program
Output:
************************************************************************
C Program
Online Compiler
************************************************************************
C++ Program
Online Compiler
************************************************************************
C# Program
************************************************************************
PHP Program
Php is a server side scripting language.
************************************************************************
JAVASCRIPT Program
<script type="text/javascript">
var string = prompt("Enter a string: ");
var letter = prompt("Enter a letter: ");
let strlen = string.length;
alert(strlen);
var counter=0;
for (var i=0; i<strlen; i++ ){
if(string[i]==letter){
counter++;
}
}
console.log(`${string} => ${letter} => ${counter}`);
//case sensitive
</script>
************************************************************************
PYTHON Program
************************************************************************
Comments
Post a Comment