I was trying to remove line breaks, but with this code below I can't proceed to remove it with replace()
method.
private String encryptBase64(String data){
byte[] values = null;
try{
values = data.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String encrypted = Base64.encodeToString(values, Base64.DEFAULT);
encrypted.replace("\r\n", "");
Log.i("base64", encrypted);
return encrypted;
}
As the code above, it's clear that I tried to remove line breaks but the code failed to do it. How to remove the line breaks?