Tagged Questions
5
votes
3answers
113 views
Using intern in java Strings
I am trying to understand Java's String class but I am having a hard time understanding the situation described below.
Consider the following example snippet:
String x = new String("Hey");
String y ...
0
votes
1answer
36 views
Sqlite columns to string array
How can i put every column from an android sqlite database into a different string array ?
I have a database with 4 columns :id,one in which i store the date,another for the hour and another for a ...
0
votes
1answer
49 views
string manipulation : insert words at certain indexes in string, simultaneously
I have searched a lot but couldn't find anything that will allow me to insert words at certain indexes simultaneously. For example :
I have a string :
rock climbing is fun, I love rock climbing.
...
0
votes
2answers
40 views
How to iterate a string in order to validate values are in range using charAt()?
I am trying to iterate a string that contains the users inputed values. I want to validate that the user only enters 4 characters and that all of them are between 1 and 4. For example, prompts the ...
-4
votes
7answers
73 views
Check if piece of String is there in string java [duplicate]
i am looking for a piece of code which can search for a string in a string.
String mainSTR = "It is Wednesday";
So i need a code that will return true if i search
"Day" or "day" or "DAY" in ...
0
votes
0answers
49 views
Start XML parser
I am very new to Java/Android programming and need a little help with a part of code that I am writing. I have been following the "Parsing XML Data" article with no success.
The intent from ...
-1
votes
0answers
24 views
Spell checking program output
I am to write a spell checking program which uses a dictionary string to find misspelled words in a test string. The program should prompt the user for the test string and the dictionary string. As ...
-2
votes
0answers
16 views
How to write a table in a mail
my feature will calculate stuff and generate a Pdf report and mail the report.
I need to make a summary of the report and send a mail with the pdf report attached .
Can i know how can i do it?
I have ...
4
votes
3answers
100 views
Java - Coding Style : What are the cons and pros of “ABC”.equals(“SOMESTRING”) style string comparison? [duplicate]
Let me first start-of with a sample code...
String password = "";
if("PIRATE".equals(password)) {
// Do something
}
See here, the String constant or literal (whatever) "PIRATE" is used to ...
0
votes
3answers
54 views
java String.split(regex) design
I'm importing a file with umpteen lines of "##,##". Each number can be one or two digits.
I'd like to use String.split(regex) to get the two numbers without the adjacent quote marks.
Understanding ...
1
vote
3answers
57 views
Trimming digits at the end of String
I want to trim the last occurring numeric characters from the String
Eg:
"abc123" => "abc"
"abc12xyz34" => "abc12xyz"
Written below snippet to extract it. Just want to explore if this can be ...
0
votes
1answer
30 views
Java Format Output to Console / JTextArea with Multiple string values
Have a program which I'd like output the values from an Array. Using tab (\t) or formatting e.g (%40s) doesnt account for strings of different lengths.
Current Code Below is Fine for the Headings.
...
0
votes
4answers
95 views
How does java recognizes anything in inverted commas as a string object?
If i write :
String s = new String("abc");
It creates an object of type String with the value "abc".
And if i write :
String s = "abc";
This also creates an object with value "abc".
How does ...
1
vote
5answers
41 views
Remove one blank cell before every filled cell in a string array
I am using this code :
ArrayList<String> getques = db.getSolutionData(levelno, level);
String str = getques.get(0);
stringarr = str.split("");
...
-2
votes
0answers
46 views
Removing one item from an array in java [on hold]
I have an inventory system and it has a few items of the same name:
p.addNewItem("Human Arm");
p.addNewItem("Human Arm");
p.addNewItem("Human Arm");
How do I remove one 'Human Arm' but keep the ...