如何在C ++中减小较小的字符串中的较大的字符串?可能是通过散列? [英] How to reduce a bigger string in smaller string in C++? Probably by hashing?

查看:114
本文介绍了如何在C ++中减小较小的字符串中的较大的字符串?可能是通过散列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C ++中将更大的字符串压缩成更小的字符串。在C ++中有什么不同的方法?要求是输出也应该是字符串。

I want to compress a bigger string into a smaller string in C++. What are the different ways to do this in C++? The requirement is that output should also be a string.

推荐答案

好吧,如果您以后不需要解压缩:

Well, if you don't need to uncompress it later:

string s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
s = "";

编辑:听起来像你想要一个哈希函数 - 在那里,根据您的要求。 Google是您的朋友。

Sounds like you want a hash function - there are a zillion out there, depending on your requirements. Google is your friend.

这篇关于如何在C ++中减小较小的字符串中的较大的字符串?可能是通过散列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆