From: Michael D. <mik...@us...> - 2004-04-12 05:52:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10243/NHibernate/Util Modified Files: StringHelper.cs Log Message: Added new methods to get the class name from a string that contains the type name. Index: StringHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/StringHelper.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** StringHelper.cs 10 Feb 2004 18:42:01 -0000 1.8 --- StringHelper.cs 12 Apr 2004 05:38:19 -0000 1.9 *************** *** 83,86 **** --- 83,111 ---- } + /// <summary> + /// Takes a fully qualified type name and returns the full name of the + /// Class - includes namespaces. + /// </summary> + /// <param name="typeName"></param> + /// <returns></returns> + public static string GetFullClassname(string typeName) + { + return typeName.Trim().Split(' ', ',')[0]; + } + + /// <summary> + /// Takes a fully qualifed type name (can include the assembly) and just returns + /// the name of the Class. + /// </summary> + /// <param name="typeName"></param> + /// <returns></returns> + public static string GetClassname(string typeName) + { + string[] splitClassname = GetFullClassname(typeName).Split('.'); + + return splitClassname[splitClassname.Length-1]; + + } + public static string Qualifier(string qualifiedName) { int loc = qualifiedName.LastIndexOf("."); |