所以我有一个文本框,我想在其中存储地址,但作为单行。为了获取其中的地址,我总是会进行复制和粘贴,问题是我从哪里复制它,它是多行的,所以当我粘贴它时,它只显示第一行。我知道我可以将其更改为多行文本框,然后使用退格键将其变为一行,但我只是想知道是否有一种方法可以用代码将其变为单行。
So I have a textbox where I want an address to be stored, but as a single line. To get the address in there I will always do a copy and paste, and the issue is that where I copy it from, it is multiline, so when I paste it, it only shows the first line. I know I can change it into a multiline textbox and then use backspace to make it one line, but I'm just wondering if there is a way I can just make it single line with code.
发布评论
评论(3)
尝试,
编辑:
Try,
EDIT:
您可以从输入中删除“\n”字符和“\r”。
You can remove '\n' characters from the input and '\r' as well.