小编obe*_*a06的帖子

c#中如何解析相对路径

我有一个结合路径的函数。例子

我的应用程序位于 D:\toto\titi\tata\myapplication.exe

我创建了一个 windows 窗体应用程序 (c#),它根据我的应用程序的路径 ( D:\toto\titi\tata\myapplication.exe)解决相对路径。

我想要这个:

1)解决的路径是 test.txt => D:\toto\titi\tata\test.txt

2)解决的路径是 .\..\..\test\test.txt => D:\toto\test\test.txt

3)解决的路径是 .\..\test\test.txt => D:\toto\titi\test\test.txt

4)解决的路径是 .\..\..\..\test\test.txt => D:\test\test.txt

5)解决的路径是 .\..\..\..\..\test\test.txt => The path doesn't exist

6)解决的路径是 \\server\share\folder\test => get the corresponding path in the server.

我用这个方法

private void btnSearchFile_Click(object sender, EventArgs e)
{
    // Open an existing file, or create a new one.
    FileInfo fi = new FileInfo(@"D:\toto\titi\tata\myapplication.exe");

    // Determine the full path of the file just created or opening. …
Run Code Online (Sandbox Code Playgroud)

c#

5
推荐指数
1
解决办法
4778
查看次数

验证正则表达式中的字符串

我想在 JavaScript 中有一个正则表达式,它可以帮助我验证仅包含小写字符 和 this 字符的字符串-

我用这个表达:

var regex = /^[a-z][-\s\.]$/
Run Code Online (Sandbox Code Playgroud)

这不起作用。任何想法?

javascript

0
推荐指数
1
解决办法
1274
查看次数

打字稿找不到名称“provide”.ts(2304)错误app.module.ts

当我在 Angular 11 中的 app.module.ts 中声明拦截器时遇到问题。我有 Visual Studio Code IDE。

在此输入图像描述

我有安装类型

npm install @types/node --save-dev 
Run Code Online (Sandbox Code Playgroud)

并修改我的 tsconfig.json。谁能帮我解决这个编译错误?

我有打字稿 4.0.2 版本

node.js typescript angular

0
推荐指数
1
解决办法
1027
查看次数

标签 统计

angular ×1

c# ×1

javascript ×1

node.js ×1

typescript ×1