• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Strings in java
 

Strings in java

on

  • 884 views

all string functions

all string functions

Statistics

Views

Total Views
884
Views on SlideShare
811
Embed Views
73

Actions

Likes
0
Downloads
17
Comments
0

3 Embeds 73

http://revisions4u.blogspot.in 51
http://www.revisions4u.blogspot.in 21
http://javaoutputs.blogspot.in 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Strings in java Strings in java Presentation Transcript

    • These functions deal only with character manipulation Character.isUpperCase() Character.isLetterOrDigit() Character.isWhiteSpac Character.toUpperCase() e()
    • Enter a letter : A The entered character is a letter This function checks whetherthe entered character is a letter or notIt return boolean value True or False
    • Enter a letter : 3 The entered character is a digit This function checks whetherthe entered character is a number or not It return boolean value True or False
    • Character.isLetterOrDigit( ) Enter a letter : A Enter a digit : 3 The entered character is a letter entered character is a digit The This function checks whetherthe entered character is a letter or a digit. It may be both It return boolean value True or False
    • Character.isWhiteSpace() Enter a letter : ) ( There is a white space This function checks whether There is a blank spaceIt return boolean value True or False
    • Character.isUpperCase() Enter a letter : A The entered character is in uppercase This function checks whetherthe entered character is capital letter or not It return boolean value True or False
    • Enter a letter : d The entered character is a letter This function checks whetherthe entered character is a lower case letter or not It return boolean value True or False
    • Enter a letter : A The character after conversion is aThis function converts the capital letter to small letter
    • Character.toUpperCase() Enter a letter : h The character after conversion is HThis function converts the lower case letters to upper case
    • class first{void main(char p){if(Character.isLetter(p) System.out.println(p+ “ is a letter”);else System.out.println(p+ “ is not a letter”);}}
    • class first{void main(char p){if(Character.isDigit(p) System.out.println(p+ “ is a Digit”);else System.out.println(p+ “ is not a Digit”);}}
    • class first{void main(char p){if(Character.isLetterOrDigit(p) System.out.println(p+ “ is a letter or digit”);else System.out.println(p+ “ is not a letter or digit”);}}
    • class first{void main(char p){if(Character.isUpperCase(p) System.out.println(p+ “ is an UpperCase”);else System.out.println(p+ “ is not an Upper Case”);}}
    • class first{void main(char p){if(Character.isLowerCase(p) System.out.println(p+ “ is a LowerCase”);else System.out.println(p+ “ is not a lower Case”);}}
    • class first{void main(char p){char x =Character.toUpperCase(p);System.out.println(“ The character after conversion is ” + x);}}
    • class first{void main(char p){char x =Character.toLowerCase(p);System.out.println(“ The character after conversion is ” + x);}}
    • CHARACTERS ASCII CODES0-9 48-57A-Z 65-90a-z 97-122
    • char p = „A‟; int n = (int)p;This will give the output as 65 because the ASCII value of A is 65
    • int x = 91;char c = (char) x; This will give the output as b B= 66 66+32 = 98 Hence 98 is b
    • The difference between ASCII code of an upper case andthe corresponding lower case is 32
    • Get the ASCII code of upper case characterIncrease ASCII code by 32Obtain character corresponding to the increased ASCII code
    • Get ASCII code of lower case characterDecrease ASCII code by 32Obtain character corresponding to the decreased ASCII code
    • These functions deal with strings equalsIgnoreCase() compareTo() indexOf() Replace() endswith() lastIndexOf() Concat() startswith() Sudstring() equals() trim()
    • This is used to find the length of the given stringSyntax:int var = string var.length();ExString s = “COMPUTER”;Int l = s.length();System.out.println(l);The output will be 8
    • This is used to find the character at a particular positionof the given stringSyntax:char var = string var.charAt(index);ExString s = “COMPUTER”;char c = s.charAt(3);System.out.println(c);The output will be P