我正在尝试使用获取的数据创建一个数组,并用它创建一个新的集合,但是生成的字符串末尾都有\r:
export const WordSetFn = async () =>{
let wordSet;
await fetch(wordsSet).then((resp) =>
resp.text()
).then((resp) =>{
const wordSetArray = resp.split("\n")
wordSet = new Set(wordSetArray)
})
return {wordSet};
} // word set would look like this: {"above\r",...}
而我从中获取数据的txt文件是一堆单词,每个单词都在下一行中,像这样:
aback abase abate abbey abbot abhor abide abled abode abort ...
现在为什么每个单词后面都会加上\r,\r是什么意思?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
\r是回车符,\n是换行符,\r\n是回车符加换行符。