Added string extension class
This commit is contained in:
21
CodeGenerator/StrExt.cs
Normal file
21
CodeGenerator/StrExt.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace CodeGenerator {
|
||||
public static class StrExt {
|
||||
public static string ParseFName(this string str) {
|
||||
str = str.Replace("*", "ptr_");
|
||||
return str;
|
||||
}
|
||||
|
||||
public static string ParseFType(this string str) {
|
||||
return str switch {
|
||||
"char" => typeof(char).AssemblyQualifiedName,
|
||||
"short" => typeof(short).AssemblyQualifiedName,
|
||||
"int" => typeof(int).AssemblyQualifiedName,
|
||||
"float" => typeof(float).AssemblyQualifiedName,
|
||||
"double" => typeof(double).AssemblyQualifiedName,
|
||||
"string" => typeof(string).AssemblyQualifiedName,
|
||||
"void" => typeof(object).AssemblyQualifiedName,
|
||||
_ => str
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user