- 1.2k
- 1
- 22
- 32
I’veI have a string of comma separated-separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected the result
int elimiateUserId = 11;
String css1 = "11,22,33,44,55";
String css2 = "22,33,11,44,55";
String css3 = "22,33,44,55,11";
// The expected result in all cases, after replacement, should be:
// "22,33,44,55"
I tried the following:
String result = css#.replaceAll("," + elimiateUserId, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiateUserId + "," , "");
This logic fails in case of css3. Please suggest me a proper solution for this issue.
Note: I'm working with Java 7
I checked around the following posts, but could not find any solution:
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiateUserId = 11;
String css1 = "11,22,33,44,55";
String css2 = "22,33,11,44,55";
String css3 = "22,33,44,55,11";
// The expected result in all cases, after replacement, should be:
// "22,33,44,55"
I tried the following:
String result = css#.replaceAll("," + elimiateUserId, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiateUserId + "," , "");
This logic fails in case of css3. Please suggest me a proper solution for this issue.
Note: I'm working with Java 7
I checked around following posts, but could not find any solution:
I have a string of comma-separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected the result
int elimiateUserId = 11;
String css1 = "11,22,33,44,55";
String css2 = "22,33,11,44,55";
String css3 = "22,33,44,55,11";
// The expected result in all cases, after replacement, should be:
// "22,33,44,55"
I tried the following:
String result = css#.replaceAll("," + elimiateUserId, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiateUserId + "," , "");
This logic fails in case of css3. Please suggest me a proper solution for this issue.
Note: I'm working with Java 7
I checked around the following posts, but could not find any solution:
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiate_user_idelimiateUserId = 1111;
String css1 = "11"11,22,33,44,55" 55";
String css2 = "22"22,33,11,44,55" 55";
String css3 = "22"22,33,44,55,11"
11";
//Expected The expected result in all cases, after replacement, should be:
// "22"22,33,44,55"55"
I tried the following:
String result = css#.replaceAll("," + elimiate_user_idelimiateUserId, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiate_user_idelimiateUserId + "," , "");
This logic fails in case of css3.
Pl This logic fails in case of css3. Please suggest me a proper solution offor this issue.
Note: I'm working with Java 7
I checked around following quesposts, but could not seefind any solution:
https://stackoverflow.com/questions/2602133/java-string-replaceall-regex
https://stackoverflow.com/questions/3935741/java-string-replaceall-regex-question
https://stackoverflow.com/questions/19964098/java-1-3-string-replaceall-replacement
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiate_user_id = 11
String css1 = "11,22,33,44,55"
String css2 = "22,33,11,44,55"
String css3 = "22,33,44,55,11"
//Expected result in all cases, after replacement, should be: "22,33,44,55"
I tried following:
String result = css#.replaceAll("," + elimiate_user_id, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiate_user_id + "," , "");
This logic fails in case of css3.
Pl. suggest me proper solution of this issue.
Note: I'm working with Java 7
I checked around following ques, but could not see solution:
https://stackoverflow.com/questions/2602133/java-string-replaceall-regex
https://stackoverflow.com/questions/3935741/java-string-replaceall-regex-question
https://stackoverflow.com/questions/19964098/java-1-3-string-replaceall-replacement
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiateUserId = 11;
String css1 = "11,22,33,44,55";
String css2 = "22,33,11,44,55";
String css3 = "22,33,44,55,11";
// The expected result in all cases, after replacement, should be:
// "22,33,44,55"
I tried the following:
String result = css#.replaceAll("," + elimiateUserId, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiateUserId + "," , "");
This logic fails in case of css3. Please suggest me a proper solution for this issue.
Note: I'm working with Java 7
I checked around following posts, but could not find any solution:
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiate_user_id = 11
String css1 = "11,22,33,44,55"
String css2 = "22,33,11,44,55"
String css3 = "22,33,44,55,11"
//Expected result in all cases, after replacement, should be: "22,33,44,55"
I tried following:
String result = css#.replaceAll("," + elimiate_user_id, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiate_user_id + "," , "");
This logic fails in case of css3.
Pl. suggest me proper solution of this issue.
Note: I'm working with Java 7
I checked around following ques, but could not see solution:
https://stackoverflow.com/questions/2602133/java-string-replaceall-regex
https://stackoverflow.com/questions/3935741/java-string-replaceall-regex-question
https://stackoverflow.com/questions/19964098/java-1-3-string-replaceall-replacement
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiate_user_id = 11
String css1 = "11,22,33,44,55"
String css2 = "22,33,11,44,55"
String css3 = "22,33,44,55,11"
//Expected result in all cases, after replacement, should be: "22,33,44,55"
I tried following:
String result = css#.replaceAll("," + elimiate_user_id, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiate_user_id + "," , "");
This logic fails in case of css3.
Pl. suggest me proper solution of this issue.
I checked around following ques, but could not see solution:
https://stackoverflow.com/questions/2602133/java-string-replaceall-regex
https://stackoverflow.com/questions/3935741/java-string-replaceall-regex-question
https://stackoverflow.com/questions/19964098/java-1-3-string-replaceall-replacement
I’ve a string of comma separated user-ids and I want to eliminate/remove specific user-id from a string.
I’ve following possibilities of string and expected result
int elimiate_user_id = 11
String css1 = "11,22,33,44,55"
String css2 = "22,33,11,44,55"
String css3 = "22,33,44,55,11"
//Expected result in all cases, after replacement, should be: "22,33,44,55"
I tried following:
String result = css#.replaceAll("," + elimiate_user_id, ""); // # = 1 or 2 or 3
result = css#.replaceAll(elimiate_user_id + "," , "");
This logic fails in case of css3.
Pl. suggest me proper solution of this issue.
Note: I'm working with Java 7
I checked around following ques, but could not see solution:
https://stackoverflow.com/questions/2602133/java-string-replaceall-regex
https://stackoverflow.com/questions/3935741/java-string-replaceall-regex-question
https://stackoverflow.com/questions/19964098/java-1-3-string-replaceall-replacement