How To Use Tamil Characters In Java
Jun 14, 2014i have to read the lines from the file? The line which has half of the tamil sentence..How to access?
View Repliesi have to read the lines from the file? The line which has half of the tamil sentence..How to access?
View RepliesIt works when i do this ,
String a = "*";
for(int i = 0; i++; i<10){
System.out.println(a);
a = a +"*";
}
but it doesn't work the other way,
String a = "***************";
for(int i = 0; i++; i<10){
System.out.println(a);
a = a - "*";
}
I searched about this online and read strings are unmutable in java but what does that exactly mean ? If the string cannot be changed how i am able to add the characters but not remove them.
I am facing an issue with my java program, it is returning/storing file name with some junk characters i,e the file name with some '?','=' and '_'. Below is the example of file names.
Ex : abc.doc
ab=?Windows-1252?Q?=c.do?c
=?Windows-1252?Q? (prefixed with space)
=?utf-8?Q? (prefixed with space)
=?iso-8859-1?Q? (prefixed with space)
I was trying to create a java program which can remove the repeated characters in a String. For ex-
Input: kamehamehaaa
Output: kameh
Here is my code:-
import java.util.Scanner;
class replace {
public static void main (String args[]) {
Scanner br = new Scanner(System.in);
System.out.println("Enter a word");
[Code] ....
On executing the program, StringOutOfBoundsIndex error occurs.
I am making a java text adventure and i am trying to add characters to it. I wrote it exactly the same as i wrote the items class (which works fine) but for some reason the character class keeps getting a null pointer exception when it gets to line 140 in the room class
characters.add(c);
game class
import java.util.ArrayList;
import java.util.HashMap;
/**
* Game class for Free Willy Five: an exciting text based adventure game.
*
[Code] ....
I am trying to make a simple platformer game in Java. When I try to move the character I made it only moves over then immediately back
import java.awt.event.KeyEvent;
public class UCC
{
private int xLoc;
private int yLoc;
private int xSpeed;
private int ySpeed;
private double gravity;
private int size;
[code]....
I'm trying to loop through a string and depending on the character, add a JLabel to a game. The problem is the character 'L' represents a lantern but is also used in the reply the game gives which is "LOOKREPLY". I've tried to use some code to ignore the LOOKREPLY bit but it's not working. Here's what I've tried.
else if(message.charAt(i) == 'L' && message.charAt(i+1) != 'O' | message.charAt(i+1) == 'Y'){
JLabel localLabel = new JLabel();
localLabel.setIcon(lantern);
panel.add(localLabel);
panel.revalidate();
panel.repaint();
But the first image on all of the JLabels is always a lantern, which is what L represents. As it's only 1 lantern this leads me to believe that it's ignoring the first 'L' but for some reason it's not ignoring the 'L' at the end of LOOKREPLY.
Is that the only way to code the JOptionPane? Seems rather similar to Sys.out
--- Update ---
I had more than this, but post was deleted somehow and this was the gist of it:
for(i = 0 ; i < charArray.length; i++){
if(Character.isDigit(charArray(i))){
address.replace("6", "*");
address.replace("7", "*");
Is there a better way to scan a character array for digits and replace any number in the array with another character ("*") in this case? The array is the address, " 1234 Runner Road " .
how we can handle the string with special characters. For instance:
123456789BNJKNBJNBJKJKBNJKBJKNBJK"VJKNBJNHBJNJKBVJ KBJKNB"VHBVBBVNBVNBVBVBVBNBVNBNBJHFBVFJB FNVJBNVJNVJDFNVJKNVJKNVJKVNNVJ NN"
I get some user inputs with double quotes and i need to split to 80 chars line.
.length fails to get the length if it contains special characters like double quotes and ?
like i have String s="11222ddeefs"
so here i want program output like 1=2
2=3
d=2
e=2
f=1
and s=1
it has to show no of duplicates in each character in string
I am trying to compare the first characters of two strings.
import java.util.Scanner;
public class testIf {
public static void main (String [] args) {
String userInput = "";
char firstLetter = '-';
[Code] .....
in the if statement i get this error Cannot invoke charAt(int) on the primitive type char...
I have the following code to check for five characters palindrome but it always give me incorrect answer that if i have a word like radar the answer it isn't a palindrome. and if i changed any thing in the code i got either stack overflow or index out of bounds exception
The code is as the following
import java.util.Scanner;
public class Palindrome {
int first =0;
static int n;
int last = 4;
int y = 0;
public static void main(String [] args)
[Code] .....
As of right now my code can take characters from a string to an array from a string like "ABCD" but the project says I have to take it from a string like "A B C D" how can I correct my code to grab the characters from a single spaced line?
Scanner sc = new Scanner(System.in);
System.out.println("Enter Order of Cars:");
String carsInput = sc.next();
int x = carsInput.length();
int[] cars = new int[x];
for (int i=0; i < cars.length; i++) {
cars[i] = carsInput.charAt(i)-64;
}
So what my program is supposed to do is take a number inputted by the use and then take a phrase. It then changes that phrases letter by the number inputted prior for example if you type in 2 as your int and Hello as your phrase you should get JGNNQ, which i can do. but the problem is that when i run it, it outputs like this:
J
G
N
N
Q
As separate characters how can I combine those characters in 1 string so it looks like JGNNQ? this is my code
import java.util.Scanner;
public class Dcod_MAin {
private static final Object[] String = null;
public static void main(String[] args){
Scanner input = new Scanner (System.in);
System.out.println("What is the day of the month");
int shift;
[Code] ....
I have some XML tags in jsp like.
<esi:assign name="searchfor">'''someval like < or >'''</esi:assign> . Now on the basic of request param i want these tags should render with value < or > on the basis of what is inside tags. I applied the below code but didn't work. Any Idea.
<c:if test="${testval}" >
<jsp:text><![CDATA[<xmp>]]></jsp:text>
</c:if>
<esi:assign name="searchfor">'''>'''</esi:assign>
<c:if test="${testval}" >
<jsp:text><![CDATA[</xmp>]]></jsp:text>
</c:if>
<input type="text" name="test" class="form-control input-sm" maxlength="20"/>
This is my textbox can i include in my tetxbox that it will no accept special characters?
Can i configure it there? like maxlength="20" w/c is character limit is set to 20, not allowing special characters be configure like that , character="speical is not allowed" something like that?
So I have 2 args[] one that reads the file name in the same directory and the other that tries to count how many of any letter (maybe even words) in the txt file ....
View Replies View RelatedI am using jdk 6 ... I came to know that how we can read strings from user input ... and how we can convert a string to int .. but i dont fount how to read a character by character from user ..
View Replies View RelatedI need to make a string filled with naughts and crosses like this one : "xxx ooo xox". There are 3 groups separated with a space. how to fill the string randomly ?
View Replies View RelatedI just need to write a simple program/function that replaces certain letters from a string (i.e. censor( "college", "aeiou" ) returns "cllg"). I'm trying to get the code right first, and then write a function for it.I basically just thought that I would iterate over the first string, and once I had the first character, I would then iterate over the second string, to see if the character exists. I'm getting a "dead code" error on my second loop because I put the second "break."
public class ap {
public static void main(String [] args){
String s = "Hello";
String s2 = "aeiou";
[code]....
Right now I have three stacks. Each stack holds characters, with the normal operations of pushing and popping. I am trying to compare two characters from stack1 and stack2(each character is a digit character). I would like to be able to do arithmetic on the digit characters and the push the answer on to a result stack.
Ex.) I pop character '3' from stack1 and '5' from stack2. Then I add the two. equaling '8' and pushing that character on to the result stack. This will hopefully in turn allow me to add arbitrary large numbers that integers will not support.
I am having trouble because I believe I am getting some ascii character values when I pop off the result stack. here is a small piece of my code
public void addition() {
char temp1 ,temp2;
int i = s1.getSize();
for(int j= 0;j<i;j++) {
temp1 = s1.pop();
temp2 = s2.pop();
if(temp1+temp2>=10)
[Code] .....
I have a Char stack: ArrayStack<Character> stek=new ArrayStack<>();
The stack is filled with numbers and characters (only '+' and '*' ), but I need to make calculations, so I need the INT values of the numbers i pop from the stack. So each time I need to make a calculation, I have to pop two numbers, convert them into INT ,then add/multiply them, and put them back into the stack again, but as CHAR (because the stack is not accepting them to be added as INT)
int a= Character.getNumericValue(stek.pop()); //stack no1
int b= Character.getNumericValue(rezultat.pop()); //stack no2
int tmp=a*b;
char tmp2 = (char) tmp;
stek.push(tmp2);
I have to check a String input from the user in the form of firstName lastName (i.e. John Smith). I have to check for an exception called NonAlphabeticCharacterException that gets thrown if there is anything but a number in that string. This is what I have right now but should I create an array of char for the alphabet and then check the whole string for non alphabetic characters?
for(int i=0; i<name.length(); i++) {
if()){
throw new NonAlphabeticCharactersException("Non-alphabetic character found");
}
}
I feel like the program is written correctly; however, the interactions pane in DoctorJava gives me numbers instead of letters. I am happy that the numbers it gives me is consistent, but it still bothers me and I do not know what to debug.
import java.util.Scanner;
public class Monogram {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String firstName, middleName, lastName;
int nameLength=1;
[code]...
I am trying to count the number of non_blank characters in a string. If there are no leading blank spaces it works fine but say i add three spaces in front it doubles the non blank characters.
import java.io.*;
import java.util.*;
public class countCharacters
{
public static void main(String[] args) throws Exception
{
String str1;
int count;
count = 0;
[Code] ....
import java.util.Scanner;
public class PassCode
{
public static final String SPECIAL_CHARACTERS = "$,#";
public static void main(String[] args)
[Code] ....
I'm having trouble with the code using char[]c, for the special characters. Every thing else seems to work correctly, expect for the special characters.