验证字符串格式的函数代码为:

Code

使用该函数:

 

string TeacherInfo = Console.ReadLine().Trim();
StrWillBeOk(
ref TeacherInfo);//验证输入的字符串是否有效
string[] theTeacherInfo = TeacherInfo.Split('-');

 

posted on 2009-04-21 21:07  蓝色侵略  阅读(446)  评论(0编辑  收藏  举报