本文介绍了我可以将CFUUID转换为30个字符或更少的字符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为我的iOS用户创建一个唯一的标识符.不幸的是,将要保存到的数据库的设置长度为30个字符,CFUUID为36(如果删除破折号,则为32).

I need to create an identifier for my iOS user that is unique. Unfortunately the database that it will be saved to has a set length of 30 characters and CFUUID's are 36 (32 if removing the dashes).

有没有一种方法可以使它变成一个较小的字符串?我认为CFUUID是十六进制的,因此可以将其转换为全ASCII吗?

Is there a way to make it into a smaller string? I think CFUUID's are hex, so would it be possible to convert it to full ASCII?

推荐答案

Jeff Atwood在装备我们的ASCII装甲. Base64 编码的GUID结果为22(包括24个字节,包括==)字节.根据帖子,您还可以使用其他ascii格式,但是Base64可能是数据库服务器中最友好的格式.

Jeff Atwood covers this in Equipping our ASCII Armor. A Base64 encoded GUID results in 22 (24 including ==) bytes. There are also other ascii formats you can use based on the post but Base64 will likely be the friendliest with the database server.

这篇关于我可以将CFUUID转换为30个字符或更少的字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 16:27