Java字符串中是否为空\ u0000? [英] Null \u0000 in Java String?

查看:931
本文介绍了Java字符串中是否为空\ u0000?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有充分的理由不将\ u0000用作Java String中的分隔符?我将自己编码和解码字符串。

Are there any good reasons not to use \u0000 as a delimiter within a Java String? I would be encoding and decoding the string myself.

这是用于保存用户输入的列表(我希望输入的类型?)字符串到Eclipse偏好并阅读它。该列表可能是可变大小的,所以我认为我不能将每个项目保存为自己的首选项。

This is for saving a list of user-inputted (I'm expecting input to be typed?) strings to an Eclipse preference and reading it back. The list may be variable size so I don't think I can save each item to its own preference.

推荐答案

以前有是一些错误处理Java字符串的库,因为null终止。我不知道它是否仍然是真的,但值得记住这些事情。特别是如果你与外部库交互,它将处理字符串为null终止。

There used to be some libraries which erroneously handled Java strings as null terminated. I don't know if it's still true but it's worth keeping such things in mind. Especially if you interop with external libraries that will handle strings as null terminated.

这篇关于Java字符串中是否为空\ u0000?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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