在Android的一个字符串变量的最大长度字符串、变量、长度、最大

2023-09-04 11:43:11 作者:风雪漫长安

似乎有一个最大长度的字符串可以有多少个字符持有。在我的情况下,它正在通过JSON填充了HTML,并在约1500个字符崩溃。

There seems to be a max length to how many chars a string can hold. In my case it’s being populated with HTML via JSON and at around 1500 chars it crashes.

有在距HTML文本没有特殊字符。

There are no special characters in the text apart from HTML.

有没有解决的办法还是这样吗?

Is there a way around this or is that it?

干杯,

麦克。

推荐答案

的最大值(实践和理论)要高得多。从理论上讲,这是2 ^ 31 - 1个字符。在实践中,你将是有限的可用内存,但即使在移动系统中,你将有超过1.5KB。

The maximums (both practical and theoretical) are far higher. Theoretically, it's 2^31 - 1 characters. In practice, you'll be limited to available memory, but even on a mobile system you'll have more than 1.5KB.

您有一个不同的问题。使用 JSON林特来,你有有效的JSON首先检查。

You have a different issue. Use JSON Lint to first check that you have valid JSON.