Sunday, 8 September 2013

How to find a string in a string that has one changing character?

How to find a string in a string that has one changing character?

I want to know how I can find a string in another string that has one
character that is changing. I've been searching and found out that I have
to use regex, but I don't really know how or if I'm doing this right:
The # symbol represents any number (or character, doesn't matter)
String original = "1 / #";
original.replaceAll(" / s", "");
What would I have to put in for s so it can replace whatever character is
there as well? I think I have to put a . that would act as a wildcard, but
do I just put it inside my replace string like " / ."?

No comments:

Post a Comment