如何使base64字符串整齐有序?

时间:2019-03-17 13:01:45

标签: c#

如何使base64字符串整齐有序?

示例字符串abcdefghijklmnopqrstuvwxyz:

YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo =

(错误)

YWJjZGVmZ2hpamtsb

W5vcHFyc3R1dnd4eXo =

(右)

我使用Convert.ToBase64String(文本)将字符串转换为base64,但是结果并不整齐且很长。

我的代码:

Query firstQuery = firestore.collection("Names").orderBy("timestamp", Query.Direction.DESCENDING).limit(10); // load 10 names

输出= + kZbKD35 + uxg5mhcXjWTmBtF5xhIjIZ0SVbI2bsUHdcO PE9 / n0MSaKcKznNJkR1hxvbCTfBnUnQ5zoLZ9pjW / s99qqPmwsha5EoMIXphljPLVPFA31aB9MKuqyW4rynf8MzR9cDK2N3nfsNnGS54OdnSVmwaS1mYiEP6Fhu2qjFAxwbu6RVyD5yuqYTVDYSxo99P2sJBHrSO2MaNeZSRyPCmu7rTqpZ6zxSVYETGS9Bfc1XbKq / ujA8SZB68Lmy / KTqEqXrGpKcw6vXxAca2phRcT92s70K7zOoF2 + L5WrHN8fH9zMXnB64JjARVrNPkTrRPZS1pYu8USZNnla5Qaw ==

1 个答案:

答案 0 :(得分:0)

这就是我的意思,谢谢@GSerg

Convert.ToBase64String(data, Base64FormattingOptions.InsertLineBreaks)