超级菜鸟叫救命!!

FWSH FWSH 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
using System;

namespace test
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Test
{
static void SplitPath(string path,out string dir,out string name)
{
int i=path.Length;
while(i>0)
{
char ch=path[i-1];
if(ch=="\\"||ch=="/"||ch==":")break;
i--;
}
dir=path.Substring(0,i);
name=path.Substring(i);
}
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
string dir,name;
SplitPath("c:\\windows\\System\\hello.txt",out dir,out name);
Console.WriteLine(dir);
Console.WriteLine(name);
//
// TODO: 在此处添加代码以启动应用程序
//
}
}
}


错误提示:
E:\myPg\test\Class1.cs(16): 运算符“==”无法应用于“char”和“string”类型的操作数


以上程序的错误该如何修改.

...全文
评论 7
收藏 已收藏
分享
返回顶部
FWSH
C# 111,128 成员 642,537 内容