在C#中复制PasteBin文本 [英] Copy PasteBin text in C#
问题描述
有没有办法从pastebin帖子中复制文本
喜欢
Clipboard.SetText(" pastebin.link" ;);
您好AloftStudios,
您想得到什么?
您要复制某个网页上的所有文字并保存吗?
如果是这样,您可以使用 WebClient.DownloadString Method(String)从网站获取文本:
public static void DownloadString(string address)
{
WebClient client = new WebClient();
string reply = client.DownloadString(address);
Console.WriteLine(回复);
}另请参阅以下链接:
您需要注意的是当您将字符串加载到StringBuilder时,您无法使用:
string reply = client.DownloadString(" website");
StringBuilder stringData = new StringBuilder();
stringData =回复;而不是:
string reply = client.DownloadString(" website");
StringBuilder stringData = new StringBuilder();
stringData.Append(回复);问候,
Stanly
Is there a way to copy the text from a pastebin post
Like
Clipboard.SetText("pastebin.link");
Hi AloftStudios,
What do you want to get?
Do you want to copy all text from a certain webpage and save it?
If so, you can use WebClient.DownloadString Method (String) to get the text from the website:
public static void DownloadString (string address) { WebClient client = new WebClient (); string reply = client.DownloadString (address); Console.WriteLine (reply); }Also please refer to the following link:
how to copy all text from a certain webpage and save it to notepad C#
What you need to pay attention to is when you load the string to StringBuilder, you can not use:
string reply = client.DownloadString("website"); StringBuilder stringData = new StringBuilder(); stringData = reply;Instead of:
string reply = client.DownloadString("website"); StringBuilder stringData = new StringBuilder(); stringData.Append(reply);Regards,
Stanly
这篇关于在C#中复制PasteBin文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!