sách gpt4 ai đã đi

Xóa dấu câu khỏi văn bản (trừ dấu &)

In lại 作者:行者123 更新时间:2023-12-05 02:31:10 32 4
mua khóa gpt4 Nike

我需要从文本中删除标点符号:

 data <- "Type the command AT&W enter. in order to save the new protocol on modem;"
gsub('[[:punct:] ]+',' ',data)

这个解决方案给出了结果

[1] "Type the command AT W enter in order to save the new protocol on modem "

这不是我想要的结果,因为我想保存 &,因此:

[1] "Type the command AT&W enter in order to save the new protocol on modem "

1 Câu trả lời

您可以尝试由任何非 $ 或字母数字组成的用户定义的正则表达式:

data <- "Type the command AT&W enter. in order to save the new protocol on modem;"

gsub('[^&[:alnum:] ]+',' ',data)

关于从文本中删除标点符号(符号 & 除外),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71662962/

32 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com