解析句子(请帮忙) [英] parsing a sentence(help please)

查看:117
本文介绍了解析句子(请帮忙)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我得到了这样的句子,例如(p1和p2),我想保留Structure,我只想将p1,p2替换为我自己的变量,然后将其更改为例如(v1和v2)这句话,而我的语言是c#.net
非常感谢

hi
i got this sentence such as (p1 and p2),i want to keep Structure , i only want to replace p1,p2 to my own variable and change it this sentence for example (v1 and v2),and my Language is c#.net
thanks a lot

推荐答案

如果使用C ++,请使用strtok()sprintf();如果使用C#或VB.NET,请使用String.Split()String.Format().
Use strtok() and sprintf() if C++, or String.Split() and String.Format() if C# or VB.NET.


由于您没有说明真正的要求,因此,根据问题描述,您可以简单地将逗号替换为,并以简单的文字替换.例如(而且我在这里假设使用C#,因为您甚至都没有说过哪种语言:
As you haven''t stated what your requirements really are, given the problem description you''ve shown you could simply replace the comma with and in a straightforward text replacement. For instance (and I''m assuming C# here since you haven''t even said which language:
string text = "V1,V2";
Console.WriteLine(string.Replace(",", " and ");

您真的需要说出您的真正要求在您将得到更好的答案之前.

You really need to say what your requirements really are before you''ll get much better as an answer.


这篇关于解析句子(请帮忙)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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