超级菜鸟叫救命!!
FWSH 2004-12-13 09:52:32 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”类型的操作数
以上程序的错误该如何修改.