Reputation: 3
I have below string that have some base64 sub string for example:
"Hello a867e4== How are you 33e42r=="
I want to decode "a867e4==" and "33e42r==" from base64,but other character not decode.how can i do this?
Upvotes: 0
Views: 748
Reputation: 30819
Assuming the base64 substrings are separated by a space, we can use split()
method to get the substrings first, as shown below:
String[] parts = string.split("\\s+");
Once that is done, we can iterate over each part and check whether it's base64 encoded, as explained in this SO answer.
Upvotes: 1