Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Important Character into string vaariable
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hina Saeed
Important Character into string vaariable
2 Answer(s)      6 years and 9 months ago
Posted in : Java Beginners


How to store the character variable into string format?


Advertisement
View Answers

April 28, 2008 at 7:13 PM


Hi friend,

import java.io.*;
import java.lang.*;
public class nativeMethods{
public static void main(String args[]){

String prabhu = "MY NAME IS BAADSHAH KHAN";
String str1 = "He Prabhu";
char[] str2 = new char[34];
System.out.println("Length of string prabhu :" + prabhu.length());
System.out.println("character at third position :" + prabhu.charAt(3));

str1.getChars(0, str1.length(), str2, 0) ;
char a = prabhu.charAt(0);
char b = prabhu.charAt(1);
char c = prabhu.charAt(2);
char d = prabhu.charAt(3);
char e = prabhu.charAt(4);
char f = prabhu.charAt(5);
char g = prabhu.charAt(6);
char h = prabhu.charAt(7);
char i = prabhu.charAt(8);
char j = prabhu.charAt(9);
char k = prabhu.charAt(10);
char l = prabhu.charAt(11);
char m = prabhu.charAt(12);
char n = prabhu.charAt(13);
char o = prabhu.charAt(14);
char p = prabhu.charAt(15);
char q = prabhu.charAt(16);
char r = prabhu.charAt(17);
char s = prabhu.charAt(18);
char t = prabhu.charAt(19);
char u = prabhu.charAt(20);

char upper = Character.toLowerCase(a);
char upper1 = Character.toLowerCase(b);
char upper2 = Character.toLowerCase(c);
char upper3 = Character.toLowerCase(d);
char upper4 = Character.toLowerCase(e);
char upper5 = Character.toLowerCase(f);
char upper6 = Character.toLowerCase(g);
char upper7 = Character.toLowerCase(h);
char upper8 = Character.toLowerCase(i);
char upper9 = Character.toLowerCase(j);
char upper10 = Character.toLowerCase(k);
char upper11 = Character.toLowerCase(l);
char upper12 = Character.toLowerCase(m);
char upper13 = Character.toLowerCase(n);
char upper14 = Character.toLowerCase(o);
char upper15 = Character.toLowerCase(p);
char upper16 = Character.toLowerCase(q);
char upper17 = Character.toLowerCase(r);
char upper18 = Character.toLowerCase(s);
char upper19 = Character.toLowerCase(t);
char upper20 = Character.toLowerCase(u);


System.out.print(upper);
System.out.print(upper1);
System.out.print(upper2);
System.out.print(upper3);
System.out.print(upper4);
System.out.print(upper5);
System.out.print(upper6);
System.out.print(upper7);
System.out.print(upper8);
System.out.print(upper9);
System.out.print(upper10);
System.out.print(upper11);
System.out.print(upper12);
System.out.print(upper13);
System.out.print(upper14);
System.out.print(upper15);
System.out.print(upper16);
System.out.print(upper17);
System.out.println(upper18);
System.out.println(str1.length());
System.out.println(str2);

}
}


April 28, 2008 at 7:15 PM


import java.io.*;
import java.lang.*;
public class don{
public static void main(String args[]){

String prabhu = "my name is baadshah khan";
String str1 = "He Prabhu";
char[] str2 = new char[34];
System.out.println("Length of string prabhu :" + prabhu.length());
System.out.println("character at third position :" + prabhu.charAt(3));

str1.getChars(0, str1.length(), str2, 0) ;
char a = prabhu.charAt(0);
char b = prabhu.charAt(1);
char c = prabhu.charAt(2);
char d = prabhu.charAt(3);
char e = prabhu.charAt(4);
char f = prabhu.charAt(5);
char g = prabhu.charAt(6);
char h = prabhu.charAt(7);
char i = prabhu.charAt(8);
char j = prabhu.charAt(9);
char k = prabhu.charAt(10);
char l = prabhu.charAt(11);
char m = prabhu.charAt(12);
char n = prabhu.charAt(13);
char o = prabhu.charAt(14);
char p = prabhu.charAt(15);
char q = prabhu.charAt(16);
char r = prabhu.charAt(17);
char s = prabhu.charAt(18);
char t = prabhu.charAt(19);
char u = prabhu.charAt(20);






char upper = Character.toUpperCase(a);
char upper1 = Character.toUpperCase(b);
char upper2 = Character.toUpperCase(c);
char upper3 = Character.toUpperCase(d);
char upper4 = Character.toUpperCase(e);
char upper5 = Character.toUpperCase(f);
char upper6 = Character.toUpperCase(g);
char upper7 = Character.toUpperCase(h);
char upper8 = Character.toUpperCase(i);
char upper9 = Character.toUpperCase(j);
char upper10 = Character.toUpperCase(k);;
char upper11 = Character.toUpperCase(l);
char upper12 = Character.toUpperCase(m);
char upper13 = Character.toUpperCase(n);
char upper14 = Character.toUpperCase(o);
char upper15 = Character.toUpperCase(p);
char upper16 = Character.toUpperCase(q);
char upper17 = Character.toUpperCase(r);
char upper18 = Character.toUpperCase(s);
char upper19 = Character.toUpperCase(t);
char upper20 = Character.toUpperCase(u);


System.out.print(upper);
System.out.print(upper1);
System.out.print(upper2);
System.out.print(upper3);
System.out.print(upper4);
System.out.print(upper5);
System.out.print(upper6);
System.out.print(upper7);
System.out.print(upper8);
System.out.print(upper9);
System.out.print(upper10);
System.out.print(upper11);
System.out.print(upper12);
System.out.print(upper13);
System.out.print(upper14);
System.out.print(upper15);
System.out.print(upper16);
System.out.print(upper17);
System.out.println(upper18);
System.out.println(str1.length());
System.out.println(str2);

}
}


------------------------------

read for more information,

http://www.roseindia.net/java/


Related Tutorials/Questions & Answers:
How to display string or character
How to display string or character  how to print character or a word without using array concept
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
Advertisements
Replace Character in String
Replace Character in String        This example replaces a character with a specified character in a given string. To replace a character with the given character in sting first
Removing character from a string in sql.
Removing character from a string in sql.  How to remove or replace character from a string
Removing character from a string in sql.
Removing character from a string in sql.  Removing special characters from a string in sql
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... java.util.*; class CountCharacters { public static void main(String[] args) throws
Get Character from String
Get Character from String       In this example we will see that how to convert string to array... toCharArray() to convert string to character array. 3. Retrieve character from
Convert string into character array
Description: This tutorial demonstrate how to convert a string into array of char. The toCharArray() method converts string to a new character array...;{   public static void main(String[] args) {  
Find Character form String example
in Action Script3:- String maintain a index position for every character 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
Java Remove a character from string
Java Remove a character from string In this tutorial, you will learn how to remove a character from the string. There are several methods for examining... to remove a particular character from the string. In the given example, we have
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
Determining the Character Boundaries in a Unicode String
Determining the Character Boundaries in a Unicode String In this section,  you will learn how to determine the character boundaries in a string. By determining the character boundaries, you will be able to break the string
PHP get character from String
PHP Get Character From String To get sub string from a String we can use substr() method. Structure of this method is : string substr (string $var... string of variable $var, the initial index position is denoted by $initial
Write a method which will remove any given character from a string?
Write a method which will remove any given character from a string? In this example we will describe remove any given character from a string... argument. It checks the character you want to remove in the string in a sequence
Convert Character into a String
Convert Character into a String   ... the functionality to convert a character into a string.  Code Description: This program takes a character at the console and converts it into a string format using
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
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
Split string after each character using regular expression
Split string after each character using regular expression... to split the String after each character using expression. For this we are going... SplittingFind.java are described below: String regex = ("\\w.+"):- Creating
In data structure in java how to parse the given string and counts the member of character that match the given data?
In data structure in java how to parse the given string and counts the member of character that match the given data?  Design a parser that parse the given string and counts the member of character that match the given data.using
Write a java program that encrypt and decrypt some string by adding or removing 2 on each character.
Write a java program that encrypt and decrypt some string by adding or removing 2 on each character.  Write a java program that encrypt and decrypt some string by adding or removing 2 on each character. Example 1 : Please Enter
String Determining a Character's Unicode Block
String Determining a Character's Unicode Block   ... explanation about the UnicodeBlock() method of String class. We are going to use UnicodeBlock() method of String class in Java. The description of the code is given
Important Question
Important Question  Respected Sir, I am Sanjay Baniwal working in BHEL as a Software Developer as a trainee for One Year. And i have been given a Project in which i have to create a JSP page with a Drop Down List in which all
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
Find number of words begin with the specified character
character from the string. To do this, we have allowed the user to input a sentence or a string and a character to search. Using StringTokenizer class, we have break down the string into tokens and matches the first character of every token
String
String  write down the code of remove any character from a given string without using any string function   please give me the code of remove any given character from a given string without using function
string
and a character. It then count the occurrence of that character in the string and display...string  How to count a particular character in a given sentence and also displaying that contain word? Like I want to find "a" in the string
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
Count Characters from the input string Java
Count Characters from the input string of Java In this section, you will learn how to count the occurrence of each character in the string. For this, we have...: Please enter string Hello World Character :H  occurs 1
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
 

 

 

DMCA.com