如何分隔两个base64字符串
答案:2 悬赏:0 手机版
解决时间 2021-02-07 16:11
- 提问者网友:愿为果
- 2021-02-06 16:02
如何分隔两个base64字符串
最佳答案
- 五星知识达人网友:迟山
- 2021-02-06 17:38
用逗号或者任意的不在base64字符串内的字符都可以。
All you have to do is to use a separator which is not a valid Basc64 character. Comma is not a base64 character so you can use.
Base64 characters are [0-9a-zA-Z/=+] (all numbers, uppercase, lowercase, forward slash plus and equal sign).
All you have to do is to use a separator which is not a valid Basc64 character. Comma is not a base64 character so you can use.
Base64 characters are [0-9a-zA-Z/=+] (all numbers, uppercase, lowercase, forward slash plus and equal sign).
全部回答
- 1楼网友:山河有幸埋战骨
- 2021-02-06 17:53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sun.misc.base64encoder;
import sun.misc.base64decoder;
// 将 s 进行 base64 编码
public static string getbase64(string s) {
if (s == null) return null;
return (new sun.misc.base64encoder()).encode( s.getbytes() );
}
// 将 base64 编码的字符串 s 进行解码
public static string getfrombase64(string s) {
if (s == null) return null;
base64decoder decoder = new base64decoder();
try {
byte[] b = decoder.decodebuffer(s);
return new string(b);
} catch (exception e) {
return null;
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯