java - 如何从字符串值在 android 中创建 CSV 文件
问题描述
如何在 android 中创建 CSV 文件,我正在获取字符串值。像 52 \n 21 \n 120 \n .... 等
我想为所有值创建一个 CSV 文件。
这是我获取字符串的代码。
String msg = new String(data);
if(newline.equals(TextUtil.newline_crlf) && msg.length() > 0) {
// don't show CR as ^M if directly before LF
msg = msg.replace(TextUtil.newline_crlf, TextUtil.newline_lf);
// special handling if CR and LF come in separate fragments
if (pendingNewline && msg.charAt(0) == '\n') {
Editable edt = receiveText.getEditableText();
if (edt != null && edt.length() > 1)
edt.replace(edt.length() - 2, edt.length(), "");
}
pendingNewline = msg.charAt(msg.length() - 1) == '\r';
}
receiveText.append(String.valueOf(TextUtil.toCaretString(msg, newline.length() != 0)));
解决方案
推荐阅读
- linkedin - 添加到个人资料功能在移动浏览器上不起作用
- java - 身份验证管理器在创建 JWT 令牌时在 Spring REST 应用程序中抛出 NullPointerException
- powershell - powershell 活动目录选择器
- reactjs - Reactstrap 折叠打开一个折叠按钮,一切都会打开
- python - 对已排序数组的串联进行排序
- solr - Solr + Typo3 :基于 indexConfig 隐藏构面
- android - 当我在我的应用 Flutter 上播放媒体时如何避开(降低音量)其他应用
- node.js - 从 yarn 工作区子包内部,运行根级脚本
- java - Jackson objectMapper readValue on String of JSON Array - 忽略错误
- html - 如何在 flex 列父级中使网格元素 100% 可用高度?