混合字符串转换 [英] Mixed character string conversion

查看:145
本文介绍了混合字符串转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何转换两个C类型的字符串

#define ABCD 0x0FA
#定义EFGH"1234牛肉"

分为两个C#类型的字符串

公共静态uint ABCD = 0x0FA;
const string EFGH ="1234 beef";

使用Python或其他任何[脚本]语言?

特别是,我想使用脚本语言将C/C ++ .h或.c文件转换为C#.cs文件.换句话说,我想用C#样式声明替换C样式的"definitions",并将新的字符串包装到c#.cs wrapper

''
使用系统;
命名空间xxx
{
类别yyy
{
....
}
}

非常感谢.

How to convert two strings of C type

#define ABCD 0x0FA
#define EFGH "1234 beef"

into two strings of C# type

public static uint ABCD = 0x0FA;
const string EFGH = "1234 beef";

using Python or any other [scripting] language?

Particularly, I would like to convert C/C++ .h or .c files into C# .cs file using scripting language. In other words, I would like to replace a C style ''definitions'' with c# style declarations and wrap new strings into c# .cs wrapper

''
using System;
namespace xxx
{
class yyy
{
....
}
}

Thank you very much.

推荐答案

也许您需要解释您的意思.您是说要获取C ++源文件并将其转换为C#源文件?在那种情况下,我想您会使用正则表达式从旧文件中生成新文件.
Perhaps you need to explain what you mean. Do you mean take a C++ source file and turn it into a C# source file ? In that case, I''d imagine that you''d use regular expressions to generate the new file from the old one.


这篇关于混合字符串转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆