Is there a limit to how much of a string Logcat will print?

后端 未结 1 1460
隐瞒了意图╮
隐瞒了意图╮ 2020-12-19 23:03

I\'m trying to figure out whether my code is pulling the whole of an RSS feed by printing the result to logcat, but it appears to only display so much of the aforementioned

相关标签:
1条回答
  • 2020-12-19 23:42

    I believe it caps the string on 1000 characters. You could split the string and then log it piece by piece like below :

    int maxLogStringSize = 1000;
    for(int i = 0; i <= veryLongString.length() / maxLogStringSize; i++) {
        int start = i * maxLogStringSize;
        int end = (i+1) * maxLogStringSize;
        end = end > veryLongString.length() ? veryLongString.length() : end;
        Log.v(TAG, veryLongString.substring(start, end));
    }
    

    hope this helps.

    0 讨论(0)
提交回复
热议问题