缩小并解开字符串功能
我有一个类似3ZWGC3XOUQ1LPBL4AJS5
的字符串。我想创建一个函数,该函数采用该字符串并像3DV3A2
等转换。它会缩短字符串,同样在导出缩短的字符串时给我上一个字符串。
我正在使用dart
btw。
3ZWGC3XOUQ1LPBL4AJS5
---------转换为---------> 3DV3A2
3DV3A2
---------转换为--------> 3ZWGC3XOUQ1LPBL4AJS5
I have a string like 3ZwgC3xOuq1LpbL4Ajs5
. I want to create a function that take that string and convert like 3DV3A2
etc. It will shorten the string and likewise give me the previous string when I export the shortened string.
I am using Dart
btw.
3ZwgC3xOuq1LpbL4Ajs5
-------- CONVERT TO --------> 3DV3A2
3DV3A2
-------- CONVERT TO --------> 3ZwgC3xOuq1LpbL4Ajs5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不可能编写一个可以压缩每个字符串的函数。充其量您可以编写一个可以压缩最多但不是全部的功能。
压缩通过在某种程度上降低冗余而起作用。您的示例字符串似乎没有很多冗余,因此可能不是很容易压缩。
It is impossible to write a function that will compress every string. At best you can write a function that will compress most, but not all, strings.
Compression works by reducing redundancy at some level. Your example string does not appear to have a lot of redundancy, so is probably not very compressible.