需要帮助C ++ [英] NEED HELP IN C++

查看:51
本文介绍了需要帮助C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好


我在Borland C ++ Builder中需要一些小帮助。

我需要用var1 | var2等格式的字符串做一些事情| VAR3 | VAR4 |"并且

将它添加到某些ComboBox(Items - > Add(" var1"),Items - > Add(" var2")等)。


请帮帮我。我怎么能在while中做到这一点功能还是什么?


最好的问候

马丁


解决方案

Marcin Borkowski写道:

我需要用var1 | var2 | var3 | var4 |"
等格式的字符串做一些事情并添加一些ComboBox(Items - > Add(" var1"),Items - > Add(" var2")
等。)




使用AnsiString。


有2种方法。 substr和pos(或strpos)。


AnsiString tmp =" var1 | var2 | var3";

int charPos = tmp.pos(" | );


所以你拥有|

的位置,并且你可以复制你想要的部分

语法:substr(index,count);


例如:

Items-> Add(tmp.substr(0,charPos) );


删除你添加的元素并重复,直到pos返回错误。

-

问候


Wolfgang


不工作:(

i不太了解c ++但是我我需要对源代码进行一些更改,因为它们已经有了这样的结果:(


请问,你能不能给我写一些指令4这个问题?

我只需要从格式为var1 | var2 | var3的字符串添加信息到

ComboBox:


它应该创建一些东西像这样:


ComboBox - >我tems->添加(" var1");

ComboBox - > Items-> Add(" var2");

ComboBox - > Items-> Add(" var3");


我不知道如何在指令中执行此操作:(


请,请再过一次------>请:(


祝你好运,

Martin

U?ytkownik" Wolfgang Senfter" ws@wwww.at> napisa3 w wiadomo?ci

news:3f ****** @ e-post.inode.at。 ..

Marcin Borkowski写道:

我需要用字符串做一些事情,比如var1 | var2 | var3 | var4 |"
并将其添加到某些ComboBox(Items - > Add(" var1"),Items - > Add(" var2")
等。)



使用AnsiString。

有2种方法.subtr和pos(或strpos)。

AnsiString tmp =" var1 | var2 | var3" ;;
int charPos = tmp.pos(" |");

所以你有|
的位置和你可以复制你想要的部分的子页面

语法:subs tr(index,count);

例如:
Items-> Add(tmp.substr(0,charPos));

删除你添加的元素并重复,直到pos返回错误。

-
问候

Wolfgang



< blockquote>


Marcin Borkowski写道:


不工作:(
我不太了解c ++但是我需要对源代码进行一些修改,这些修改是我有的:(




聘请程序员来做。

这就是我们付出的代价。

-

Karl Heinz Buchegger
kb ****** @ gascad.at


Hello

I need some small help in the Borland C++ Builder.
I need to do something with string in format like "var1|var2|var3|var4|" and
add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2") etc.).

Help me, please. How can i do it in the "while" function or something?

Best regards
Martin


解决方案

Marcin Borkowski wrote:

I need to do something with string in format like "var1|var2|var3|var4|"
and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2")
etc.).



use the AnsiString.

there are 2 methods. substr and pos ( or strpos ).

AnsiString tmp = "var1|var2|var3";
int charPos = tmp.pos("|");

so you have the position of the |
and with the substr you can copy the part you want

syntax: substr(index, count);

example:
Items->Add(tmp.substr(0, charPos));

delete the elemnt you added and repeat that until pos returns an error.
--
Greetings

Wolfgang


don''t work :(
i don''t know c++ very well but i need to do some changes in source code that
i have got :(

PLEASE, could you write me some whilte instruction 4 this problem?
I only need to add informations from string in format "var1|var2|var3" to
the ComboBox:

It should create something like this:

ComboBox -> Items->Add("var1");
ComboBox -> Items->Add("var2");
ComboBox -> Items->Add("var3");

Adn i don''t know how can i do it in while instruction :(

PLEASE, PLEASE and one more time ------> PLEASE :(

Best regards,
Martin
U?ytkownik "Wolfgang Senfter" <ws@wwww.at> napisa3 w wiadomo?ci
news:3f******@e-post.inode.at...

Marcin Borkowski wrote:

I need to do something with string in format like "var1|var2|var3|var4|"
and add it to some ComboBox (Items -> Add("var1"), Items -> Add("var2")
etc.).



use the AnsiString.

there are 2 methods. substr and pos ( or strpos ).

AnsiString tmp = "var1|var2|var3";
int charPos = tmp.pos("|");

so you have the position of the |
and with the substr you can copy the part you want

syntax: substr(index, count);

example:
Items->Add(tmp.substr(0, charPos));

delete the elemnt you added and repeat that until pos returns an error.
--
Greetings

Wolfgang





Marcin Borkowski wrote:


don''t work :(
i don''t know c++ very well but i need to do some changes in source code that
i have got :(



Hire a programmer to do it.
That''s what we are paid for.
--
Karl Heinz Buchegger
kb******@gascad.at


这篇关于需要帮助C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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