find the first character is vowel or not

Ads
 

find the first character is vowel or not

hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check wehter it contains a space any where 4)replace all the "a" with "e" 5) extract the last three characters and check if it is "com" or not

View Answers

March 12, 2011 at 12:14 PM

<html>
<script>
function check(){
var str=document.getElementById("st").value;
var ch=str.charAt(0);
if(ch=='A'||ch=='a'||ch=='E'||ch=='e'||ch=='I'||ch=='i'||ch=='O'||ch=='o'||ch=='U'||ch=='u'){
alert("First character of string is vowel");
}
else{
alert("First character of string is not vowel");
}
var ch1=str.charAt(str.length-1);
if(ch1==ch){
alert("Last character is same as the first character");
}
else{
alert("Last character is not same as the first character");
}
var space = new RegExp("/^\s+$/");
if (space.test(str)) {
alert("String contains white space character");
}
else{
alert("String does not contain white space character");
}
var newst=str.replace("a","e");
alert("New String: "+newst);
var s=str.substr(-3);
if(s=="com"){
alert("It is com");
}
else{
alert("No");
}
}
</script>
Enter string <input type="text" id="st"><input type="button" value="check" onclick="check();">
</html>

March 12, 2011 at 2:20 PM

<p><html>
<head></p>

<script type="text/javascript">
function strfun()
{
    my_str="aeiouAEIOU";
    my_char=document.forms(0).t1.value.charAt(0);
if(my_str.indexOf(my_char)>=0)
{
alert("the 1st character vowel");
}
else
{
alert("The 1st character is not a vowel");}


var str1,str2;
str1=document.forms(0).t1.value.charAt(0);
str2=document.forms(0).t1.value.charAt((document.forms(0).t1.value.length)-1);
if(str1==str2)
{
alert("last and first chracter are same");
}

 var a=document.forms(0).t1.value;
    for(i=0;i<a.length;i++)
    {
    if(a.charCodeAt(i)==32)
    {   alert("string contains white space character");

    }
}
document.forms(0).t1.value=document.forms(0).t1.value.replace(/a/gi,'e');
{
    alert("replace a with e");}

 var s=a.substr(a.length-3,a.length);
if(s=="com")
{alert("it is com");
}
else
{alert("it is not com");}

}

</script>

<p></head>
<body></p>

<form name="f1" method="post">
<table>
<tr>
<td>Enter String:</td>
<td><input type="text" name="t1"></td>
</tr>
<tr>
<td><input type="button" value="submit" onclick="strfun()"></td>
<td><input type="reset" value="reset"></td>
</tr>
</table>
</form>

<p></body>
</html></p>

Ads









Related Tutorials/Questions & Answers:
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check
Find the percentage of words which starts with a vowel in a file
Find the percentage of words which starts with a vowel in a file   Question: Find the percentage of words which starts with a vowel in a file. Ex: Input: Contents of File1- There is an endless loop in the program. Output: Vowel
Advertisements
Find out last character of array
Find out last character of array  How we can find out the last character of array in java program
vowel
vowel  display all the vowel from word/string   import java.util.*; class DisplayVowels { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter
find all unique character in string using java
find all unique character in string using java  example: hello how are you. output should be waryu
ModuleNotFoundError: No module named 'osm-find-first'
ModuleNotFoundError: No module named 'osm-find-first'  Hi, My... named 'osm-find-first' How to remove the ModuleNotFoundError: No module named 'osm-find-first' error? Thanks   Hi, In your python
To find first two maximum numbers in an array
To find first two maximum numbers in an array  Java program to find first two maximum numbers in an array,using single loop without sorting array
how to split string after first occurrence of alphanumeric character?
how to split string after first occurrence of alphanumeric character?  String strArray="135(i),15a,14(g)(q)12,67dd(),kk,159";//splited by ',' divide string after first occurrence of alphanumeric value/character expected output
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
plz give me program to this: Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1
2. Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
2. Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1 Abracadabra, 2 Abracadabra, 3
java string vowel program
java string vowel program  java string vowel program   Please visit the following links: Display the word that begins with vowel Java Count Vowels
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
ModuleNotFoundError: No module named 'vowel-versificon'
ModuleNotFoundError: No module named 'vowel-versificon'  Hi, My... named 'vowel-versificon' How to remove the ModuleNotFoundError: No module named 'vowel-versificon' error? Thanks   Hi, In your
Character Class
Character Class  Character defines the forDigit();,digit()methods..how can these b used and wht is radix point signifies here...in the arguments of these two???..pls answer a code on this with radix .. are these methods also
underscore as character
underscore as character  how can i consider _ as a character instead of wildcard character? my problem is like this i have 20 records as follows manohar 1234455 manohar 453635 manohar 345454 manohar_1234455 now when i am
Character class
Character class   Character defines the forDigit();,digit()methods..how can these b used and wht does radix point signify here.i want to knw what basically radix is??here in the arguments of these two???because i tried runnin
How to convert entity character to html character
How to convert entity character to html character  How to convert entity character to html character
How to convert entity character to html character
How to convert entity character to html character  Please help me to "convert entity character to html character" in java. If possible please provide source code which take String as input and return as String
Character Wrapper Class.
Character Wrapper Class.  what are Mirrored Unicode Characters?? and whats the use of "isMirrored(ch);method ??.where ch is any character argument.... There are special characters in UNICODE to achieve the RTL. Such character is the Mirroring
character as command line arguments
character as command line arguments  public class testing { public static void main(String args[]) { char a; a=args[0]; System.out.println("character is:"+a); } } what will be the above program output
password validation with special character
password validation with special character  how to validate password with special character using java script
How to display string or character
How to display string or character  how to print character or a word without using array concept
count the repeated character in one string
count the repeated character in one string  to find the how character occurrence in one String (for example the string is -java means there is 2...; } if(!flag){ System.out.println("Character :"+ch+" occurs "+count+" times
JavaScript regex validate Character
Character.   <html> <head> <title>Character validation... Character value : "+name); return true; } alert("It is not valid character !"); return false; } </script> <
JavaScript regex validate Character
Character   <html> <head> <title>Character validation... Character value : "+name); return true; } alert("It is not valid character !"); return false; } </script> <
Character Directions in java
Character Directions in java  java 2,version 1.4 adds a method "getDirectionality();" , what is the use of this method ?   This method returns the Unicode directionality property for the given character. Character
First Java Program
Welcome to java tutorial series. In this lesson, you will learn to create your first Java program. In Java, all source code is written in plain text file... Machine. You can write a Hello World program as your first Java program. To write
Wrapper Character class.
Wrapper Character class.  How do the methods 'isIndentifierIgnorable(ch)' and 'isISOControl(ch)' work?? while workin with 'Character' wrapper class...: This method returns true if the character may be part of a Unicode identifier; false
J2ME count character into string
J2ME count character into string  i am new in J2ME, my problem is how to count character into number, i had been research google for almost 2 days... form which allow user to input character user input helloworld then press
Unknown Character set: 'utf8mb4'.
Unknown Character set: 'utf8mb4'.  While working on eclipse on an application that uses MySQL as the back end for the database, I was having error...: Unknown Character set: 'utf8mb4'. I'm using WAMPSERVER 2.2 and Eclipse

Ads