在C#中复制PasteBin文本 [英] Copy PasteBin text in C#

查看:160
本文介绍了在C#中复制PasteBin文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从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(回复);
}

另请参阅以下链接:


如何复制所有文本某个网页并将其保存到记事本C#


您需要注意的是当您将字符串加载到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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆