How to I replace the word the regardless of case [on hold]
up vote
-4
down vote
favorite
I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}
public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}
}
The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."
java regex
New contributor
put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-4
down vote
favorite
I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}
public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}
}
The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."
java regex
New contributor
put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
1
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago
add a comment |
up vote
-4
down vote
favorite
up vote
-4
down vote
favorite
I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}
public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}
}
The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."
java regex
New contributor
I can get one variation of the word "the" or "THE" or some other mix of all caps and lowercase but how do I replace all without case sensitivity?. What I have is:
public class StringPlay {
// find all the instances of the word the in my essay
public StringPlay(String s)
{}
public String ridOfThes(String Essay)
{
String s= "The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.";
String change= s.replaceAll("the", "z");
return change;
}
public static void main(String args) {
StringPlay stringPlay= new StringPlay("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake.");
System.out.println(stringPlay.ridOfThes("The weakness lies in the legs of the jaws, in the teeth of the days and the renting of the lake."));
}
}
The output here is:
"The weakness lies in z legs of z jaws, in z teeth of z days and z renting of z lake."
java regex
java regex
New contributor
New contributor
edited 2 days ago
New contributor
asked 2 days ago
panickingn00b
11
11
New contributor
New contributor
put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal♦ yesterday
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal
If this question can be reworded to fit the rules in the help center, please edit the question.
1
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago
add a comment |
1
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago
1
1
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
Here is the answer you are looking for stackoverflow.com/questions/5054995/…
– dividedbyzero
2 days ago