0

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?

3
  • 1
    Is the sentence always going to be the same? Meaning will it always be "Hello {base64} How are you {base64}"? Commented Feb 29, 2016 at 22:34
  • Unless the format is very predictable, you're in for a lot of ambiguity... as various english words, e.g. "test", are also a valid base64 encoded string with a totally different value. Commented Feb 29, 2016 at 22:37
  • Please consider asking a more complete question. Paste what you have tried, what results you are getting, what results you were expecting, and take the time to make sure your grammar is acceptable. Thank you. Commented Feb 29, 2016 at 22:44

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.