通过 C# 生成 ascii 艺术
我曾经为一份工作做过编程测试,其中涉及用 C# 制作 ASCii 艺术作品。我在这方面做得并不好,因为我对用 C#(或任何编程知识)执行此操作几乎没有想法或经验。
.NET 中是否有任何值得了解/练习的资源或类?
I once did a programming test for a job, which involved producing ASCii art in C#. I didn't really do well at this, as I had little idea or experience of doing this in C# (or in any programming knowledge).
Are there any resources or classes in .NET that would be worth knowing/practising on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
ASCII 艺术非常通用,但如果您想生成 ASCII 横幅或标题,那么我已将流行的 Figlet 字体生成移植到 .NET:
https://github.com/drewnoakes/figgle
它非常易于使用,并且可以在 NuGet 上获得几乎所有 .NET 版本(
netstandard1.3
及更高版本,所以 .NET Framework 以及 .NET Core、Xamarin 等...)。制作通过:
ASCII art is pretty general, but if you want to produce an ASCII banner or heading then I've ported the popular FIGlet font generation to .NET:
https://github.com/drewnoakes/figgle
It's very easy to use, and available on NuGet for almost every version of .NET (
netstandard1.3
and above, so .NET Framework as well as .NET Core, Xamarin, etc...).Produced via:
阅读这篇文章
http://www.c-sharpcorner.com/UploadFile/dheenu27/ ImageToASCIIconverter03022007164455PM/ImageToASCIIconverter.aspx
它允许您上传将转换为 ASCII 艺术的图像:) 非常酷的东西。
CodeProject 也有一个示例
http://www.codeproject.com/KB/web-image/ascii_art_with_c_。 ASPX
Have a read at this post
http://www.c-sharpcorner.com/UploadFile/dheenu27/ImageToASCIIconverter03022007164455PM/ImageToASCIIconverter.aspx
It allows you to upload an image which will be converted into ASCII art :) Pretty cool stuff.
CodeProject has a sample too
http://www.codeproject.com/KB/web-image/ascii_art_with_c_.aspx
经过一番研究,我发现最好的方法是:
1.转到文本到 ASCII 艺术生成器 (TAAG)。
2. 输入您的文字。
3.更改设置以使文本看起来适合您。
3. 单击“选择并复制”
4. 在C# 代码类型如下:
确保在引号前添加 @ 符号,以便格式保持不变,否则编辑器会给您带来很多错误。
After some research I found out that the best way to do it is this:
1. go to Text to ASCII Art Generator (TAAG).
2. type your text.
3. Change the settings to make the text look right to you.
3. click "Select & Copy"
4. In the C# code type this:
Make sure you add the @ sign before the quotes so that the formatting stays the same, otherwise the editor will give you lots of errors.
要了解完整的 ASCII“谱”,应该了解 ASCII 图表,也称为 ASCII 表。
http://www.asciitable.com/
知道了这一点,就可以获取在 codeproject 链接中找到的代码并用它创造一些“独特”的东西。 :-)
如果你仔细想想,它只是一个“查找”表,你可以从中提取一个值并做你想做的任何事情。
To understand the full ASCII "spectrum" one should know about the ASCII Chart, also known as the ASCII Table.
http://www.asciitable.com/
Knowing that, one could take code found in the codeproject link and make something "unique" with it. :-)
If you think about it, it's just a "look-up" table and you can pull a value out of it and do anything you want.