These functions deal only with character manipulation                               Character.isUpperCase() Character.isLe...
Enter a letter :                    A      The entered character is a letter    This function checks whetherthe entered ch...
Enter a letter :                      3       The entered character is a digit     This function checks whetherthe entered...
Character.isLetterOrDigit(     )        Enter a letter :                       A                 Enter a digit : 3        ...
Character.isWhiteSpace()     Enter a letter : )                    (      There is a white space   This function checks wh...
Character.isUpperCase()       Enter a letter :                      A        The entered character is in uppercase       T...
Enter a letter :                          d           The entered character is a letter          This function checks whet...
Enter a letter :                        A         The character after conversion is   aThis function converts the capital ...
Character.toUpperCase()      Enter a letter :                     h       The character after conversion is   HThis functi...
class first{void main(char p){if(Character.isLetter(p)         System.out.println(p+ “ is a letter”);else         System.o...
class first{void main(char p){if(Character.isDigit(p)         System.out.println(p+ “ is a Digit”);else         System.out...
class first{void main(char p){if(Character.isLetterOrDigit(p)         System.out.println(p+ “ is a letter or digit”);else ...
class first{void main(char p){if(Character.isUpperCase(p)         System.out.println(p+ “ is an UpperCase”);else         S...
class first{void main(char p){if(Character.isLowerCase(p)         System.out.println(p+ “ is a LowerCase”);else         Sy...
class first{void main(char p){char x =Character.toUpperCase(p);System.out.println(“ The character after conversion is ” + ...
class first{void main(char p){char x =Character.toLowerCase(p);System.out.println(“ The character after conversion is ” + ...
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 c...
Get ASCII code of lower case characterDecrease ASCII code by 32Obtain character corresponding to the decreased ASCII code
These functions deal with strings                                    equalsIgnoreCase()                                   ...
This is used to find the length of the given stringSyntax:int var = string var.length();ExString s = “COMPUTER”;Int l = s....
This is used to find the character at a particular positionof the given stringSyntax:char var = string var.charAt(index);E...
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Strings in java
Upcoming SlideShare
Loading in...5
×

Strings in java

841

Published on

all string functions

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
841
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
34
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Strings in java

  1. 1. These functions deal only with character manipulation Character.isUpperCase() Character.isLetterOrDigit() Character.isWhiteSpac Character.toUpperCase() e()
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. 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
  8. 8. Enter a letter : A The character after conversion is aThis function converts the capital letter to small letter
  9. 9. Character.toUpperCase() Enter a letter : h The character after conversion is HThis function converts the lower case letters to upper case
  10. 10. 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”);}}
  11. 11. 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”);}}
  12. 12. 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”);}}
  13. 13. 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”);}}
  14. 14. 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”);}}
  15. 15. class first{void main(char p){char x =Character.toUpperCase(p);System.out.println(“ The character after conversion is ” + x);}}
  16. 16. class first{void main(char p){char x =Character.toLowerCase(p);System.out.println(“ The character after conversion is ” + x);}}
  17. 17. CHARACTERS ASCII CODES0-9 48-57A-Z 65-90a-z 97-122
  18. 18. char p = „A‟; int n = (int)p;This will give the output as 65 because the ASCII value of A is 65
  19. 19. int x = 91;char c = (char) x; This will give the output as b B= 66 66+32 = 98 Hence 98 is b
  20. 20. The difference between ASCII code of an upper case andthe corresponding lower case is 32
  21. 21. Get the ASCII code of upper case characterIncrease ASCII code by 32Obtain character corresponding to the increased ASCII code
  22. 22. Get ASCII code of lower case characterDecrease ASCII code by 32Obtain character corresponding to the decreased ASCII code
  23. 23. These functions deal with strings equalsIgnoreCase() compareTo() indexOf() Replace() endswith() lastIndexOf() Concat() startswith() Sudstring() equals() trim()
  24. 24. 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
  25. 25. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×