Home Answers Viewqa Java-Beginners Important Character into string vaariable

 
 


Hina Saeed
Important Character into string vaariable
2 Answer(s)      5 years and a month ago
Posted in : Java Beginners

How to store the character variable into string format?

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 Pages:
Important - Java Beginners
Important Character into string vaariable  How to store the character variable into string format?  Hi friend,import java.io.*;import... of string prabhu :" + prabhu.length()); System.out.println("character
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
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
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
string
string  read a sentence and replacing character with immediate preeceding character ex: input:Be careful output:Ad bzqdetk
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
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
Summary - Character
for manipulating the strings. Most important use of Character class is to convert the data...Java: Summary - Character Character class static methods In this section we will see the static methods of Character class. Character class of Java API
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
string
() ) { String token = st.nextToken(); Character ch=Character.valueOf(token.charAt...string  a java program to input a string and display the string with the first character of every word in capital   import java.util.
Important Java Interview Question
Important Java Interview Question  Complete the Solver constructor so that a call to solveAll return a list with 2 values including the square root... result; } public static void main(String[]args){ new Solver
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
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
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
character literal in octal format
character literal in octal format  class EscapeSequence1 { public static void main(String args[]) { char ch='\141'; //this works correctly...;>> EscapeSequence1.java:6: error: unclosed character literal char
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... CountCharacters { public static void count(final String str){ Runnable
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
Character count by while loop
Character count by while loop  Write the program to count the number... CountCharacters { public static void main(String[] args) throws Exception...)); System.out.print("Please enter string "); System.out.println(); String str
character counter - Java Beginners
character counter  how to show only first three characters...{ BufferedReader in2=new BufferedReader(new InputStreamReader(System.in)); String...!!"); } else{ System.out.println("First Three Character is:"+c[0]+c[1]+c[2
illeagal character error....
illeagal character error....   Here is my code: import java.io.... static void main(String args[]){ new...:19: illegal character: \96 ` Container container
Check for character in lower case or not.
;class CheckLower {   public static void main(String
Convert Character into Integer
. It parses the string argument as a signed Integer value. Whenever the given character... Convert Character into Integer       In this section, you will learn to convert the character
Character encoding problem with chinese language
Character encoding problem with chinese language  I have a issue with characters in chinese locale in java. Iam using eclipse IDE My code is "java.util.Date stdDate = new SimpleDateFormat("dd/MM/yyyy").parse(10/10/2012); String
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
word and character counting - Java Beginners
word and character counting  here is the java code i made but i have...(String args[]) { String inFile = "c:\\LowerCase.txt"; String outFile... FileWriter(outFile); PrintWriter out = new PrintWriter(x); String line
Java get middle character
Java get middle character In this tutorial, you will learn how to get middle character from the word. Here is an example of getting the middle letter of the word entered by the user using Java. If you have a word string 'company
javascript regex validate Special character
javascript regex validate Special character   javascript regex validate Special character   <html> <head> <title>Zip... regular expression. ^ shows beginning of string
Check for character is letter or digit.
Description .style1 { background-color: #FFFFCC; } Description: This tutorial demonstrate how to check a character variable value...;static void main(String[] args) {     
Wraps a character sequence into a buffer.
Wraps a character sequence into a buffer. In this tutorial you will see how to wraps a character sequence into a buffer. Here in this example a string variable is having a sequence of character which is further wrapped into a buffer
Wraps a character array into a buffer
Wraps a character array into a buffer In this tutorial you will see how to wraps a character array into a buffer. The public static CharBuffer wrap(char[] array) method allow character array to wrap it into a buffer. Code
Convert a Character into the ASCII Format
Convert a Character into the ASCII Format   ... a character data into the ASCII format. The java.lang package provides the functionality to convert the  character data into the ASCII format Description
Java I/O Character Streams
Java I/O Character Streams In this section we will discuss the I/O Character Streams. Character streams works with the characters rather than the byte... for every character) conventions. In such kind of storage characters becomes
Conversion of unicode to its corresponding character
Conversion of unicode to its corresponding character  i have a string of unicodes e.g String s="\c0059\c0049\c3000" .. i need code for converting these unicodes to its corresponding alphabets.. pls if possible rep asap as i need
Check for character is letter or not.
;{   public static void main(String[] args) 
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
Check for character is digit or not.
;{   public static void main(String[] args) 
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
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
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.