Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Search a string in ByteArray

  Asked By: Asksuresh    Date: Nov 12    Category: Java    Views: 2118
  

I have a byteArray (byte[] ) I need to search if it contains a string, how can i serach a string in ByteArray?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Fabia Ferrrari     Answered On: Nov 12

you can use the following code :



char[] chars = // your initialization
 string  s = String.valueOf(chars);
if(s.contains("your substring")){
// do domething
}
else{
// do domething
}

also for more complicated you can use regular expressions.

 
Didn't find what you were looking for? Find more on Search a string in ByteArray Or get search suggestion and latest updates.




Tagged: