samedi 9 mai 2015

How to properly use Pattern in Java with a String of numbers

I'm trying to use Pattern in Java and I'm having a problem.

I want to find from a String[] that contains numbers (that I retrieved from a file) if they match another string of numbers (also from a file).

E.g. I have the number 1 and I want to search in a String like this: 5 10 1 8 6 3 -1 10 8 10 10 4 10 -1 10 10 10 10 9 10 -1 10 10 10 10 10 10 -1 10 10 10 10 10 10 -1 -2.

Obviously the -1 and 10 are not what I'm locking for. Is there a way to solve this?

I can't use use Pattern.compile() with an integer.

Aucun commentaire:

Enregistrer un commentaire