how to find vowels in a string in javascript
Introduction:
Here I will explain how to find vowels in a string in javascript. In javascript such a not inbuilt function to get how to find vowels in a string in javascript so I have create this small function to how to find vowels in a string in javascript . It is easiest way to how to find vowels in a string in javascript.
In previous post I explained System.Array' does not contain a definition for 'Count' how to access session in class c# how to create chat application in asp.net using c# sql query to get daily count and many article about Asp.net javascript and C#
Search:
Javascript function:
Complete Example for how to find vowels in a string in javascript:
2. file size validation in jquery
3. calling web service without adding web reference
4. How to bind CheckBoxList from database
5. How to bind DropdownList from database
Introduction:
Here I will explain how to find vowels in a string in javascript. In javascript such a not inbuilt function to get how to find vowels in a string in javascript so I have create this small function to how to find vowels in a string in javascript . It is easiest way to how to find vowels in a string in javascript.
In previous post I explained System.Array' does not contain a definition for 'Count' how to access session in class c# how to create chat application in asp.net using c# sql query to get daily count and many article about Asp.net javascript and C#
Search:
how to find vowels in a string in javascript
Javascript function:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | function VowelsData() { var Data = document.getElementById('txtData').value; if (Data == "") { alert('Enter value to check find vowels in a string'); return; } var Count = 0; var Vowels = ""; for (var Counter = 0; Counter < Data.length; Counter++) { if (Data.charAt(Counter).match(/[a-zA-Z]/) != null) { if (Data.charAt(Counter).match(/[aeiouAEIOU]/)) { Vowels = Vowels + Data.charAt(Counter); Count++; } } } if (Vowels == "") { Vowels = "Oops No Vowels"; } document.getElementById('lblVowels').innerHTML = Vowels; document.getElementById('lblVowelsCount').innerHTML = Count; } |
Complete Example for how to find vowels in a string in javascript:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <html> <head> <title>how to find vowels in a string in javascript</title> <script> function VowelsData() { var Data = document.getElementById('txtData').value; if (Data == "") { alert('Enter value to check find vowels in a string'); return; } var Count = 0; var Vowels = ""; for (var Counter = 0; Counter < Data.length; Counter++) { if (Data.charAt(Counter).match(/[a-zA-Z]/) != null) { if (Data.charAt(Counter).match(/[aeiouAEIOU]/)) { Vowels = Vowels + Data.charAt(Counter); Count++; } } } if (Vowels == "") { Vowels = "Oops No Vowels"; } document.getElementById('lblVowels').innerHTML = Vowels; document.getElementById('lblVowelsCount').innerHTML = Count; } </script> </head> <body> <h1>how to find vowels in a string in javascript</h1> <div style="padding: 50px"> <table border="0" cellpadding="3" cellspacing="3"> <tr> <td>Enter Input : </td> <td> <input type='text' id='txtData' > </td> </tr> <tr> <td colspan="2"> <input type='button' value='Find Vowels' onclick="VowelsData();"> </td> </tr> <tr> <td>Total Vowels Count : </td> <td> <label id="lblVowelsCount"></label> </td> </tr> <tr> <td>Total Vowels : </td> <td> <label id="lblVowels"></label> </td> </tr> </table> </div> </body> </html> |
You might also like
1. file type validation in jquery2. file size validation in jquery
3. calling web service without adding web reference
4. How to bind CheckBoxList from database
5. How to bind DropdownList from database
No comments:
Post a Comment