问题标签 [textwriter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
82 浏览

c# - 如何从字符串中删除最后一个字符

所以我正在编写一个 C# 程序,它将几个文本文件组合成一个并将它们保存为一个组合文本文件。One issue I am having, I have a textfield which selects the intended folder the save the compiled reciept, however when selecting the desired folder, it generates a file name to the text box, the filename follwing the final / must be erased every time for保存功能正常工作。我想知道,如何删除文件目录中最后一个 / 之前最后一个字母之后的所有文本?

这是代码:

0 投票
0 回答
40 浏览

c# - C# Console.SetOut(TextWriter) 没有设置 Console.Out 属性

在使用 Console.SetOut 将自定义 TextWriter 放在那里后,我在从控制台检索自定义 TextWriter 时遇到问题。

这是使用 StreamWriter 的简化版本:

Console.SetOut(TextWriter) 的文档说它将 Out 属性设置为以 TextWriter 对象为目标。

我正在使用 Visual Studio 2022,目标是 Net6.0。