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 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>









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 Character form String example
in the string. The first character index position is 0.  String provide charAt() method to find out the character in the string with the help of index position, and also find the character code using charCodeAt() method. User can see how
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
Find Successively Repeated Character using Java
Find Successively Repeated Character using Java In this section, we are going to find the successively repeated character using Regular Expression... Repeated Character is m
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
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 find the first 6 characters of string in regex?
How to find the first 6 characters of string in regex?  How to find the first 6 characters of string in regex. I know the Syntax...(0,7)); But i need the syntax to find the first 6 characters of string in regex
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
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
Find number of words begin with the specified character
down the string into tokens and matches the first character of every token...Count number of words begin with the specified character In this section, you... character from the string. To do this, we have allowed the user to input a sentence
java vowel program - Java Beginners
java vowel program  Write a program to Print all the words that start with a vowel and end with a consonant. For example : Input :â??the purpose... = st.nextToken(); Character ch=Character.valueOf(token.charAt(0)); if ((ch
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
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
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
Replace Character in String
in a given string. To replace a character with the given character in sting first... find then replace the "oldChar" with newChar (character name to replace... Replace Character in String      
replace character in php
replace character in php  PHP script that replace 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
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
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
php remove last character
php remove last character  to remove the last character, i used the trim function which is not working
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
character counter - Java Beginners
character counter  how to show only first three characters...!!"); } else{ System.out.println("First Three Character is:"+c[0]+c[1]+c[2... to show first three characters of entered name. import java.io.*; class
Determining the type of Character
Determining the type of Character In this section, you will learn how to determine the type of a character. You can use the methods of Character class to determine the properties of a character. This class provides several methods
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> <
What is Character Functions
What is Character Functions  What is Character Functions   Hi, Here is the answer,ADS_TO_REPLACE_1 Character Functions are INITCAP, UPPER, LOWER, SUBSTR & LENGTH. Additional functions are GREATEST & LEAST
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
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
character literal in octal format
character literal in octal format  class EscapeSequence1 { public...;>> EscapeSequence1.java:6: error: unclosed character literal char... ^ EscapeSequence1.java:6: error: unclosed character literal char ch2
Alphabet Character Case-Converter
Alphabet Character Case-Converter   ... a character (uppercase) into a lowercase character. The java.lang package provides the functionality to convert the uppercase character into a lowercase character
Get Character from String
Get Character from String     ... of character and retrieve elements from that character array one by one. Description of the code: 1. First declare and initialize string. 2. use method
Removing character from a string in sql.
Removing character from a string in sql.  How to remove or replace character from a string
Setting the default Java character encoding?
Setting the default Java character encoding?  Setting the default Java character encoding
Count the character in java
Count the character in java  Write a java program to count the character ââ?¬Ë?aââ?¬â?¢ typed by the user in a paragraph by implementing thread.   Count characters by implementing thread import java.util.*; class
Character count by while loop
Character count by while loop  Write the program to count the number of characters entered until a full stop (.)is keyed-in. Anyone there pls help...]) flag=true; } if(!flag){ System.out.println("Character :"+ch+" occurs "+count
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
Find Twin Primes Number using Java
Find Twin Primes Number using Java In this section, you will learn how find primes and twin primes from the first 100 natural numbers. For this, we have used... by 1 and the number itself. Here we are going to find twin primes. Twin Primes

Ads