语法:substr(index,count); 例如: Items-> Add(tmp.substr(0,charPos) ); 删除你添加的元素并重复,直到pos返回错误。 - 问候 Wolfgang 使用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 Marcin Borkowski写道: 聘请程序员来做。 这就是我们付出的代价。 - Karl Heinz Buchegger kb ****** @ gascad.at HelloI need some small help in the Borland C++ Builder.I need to do something with string in format like "var1|var2|var3|var4|" andadd 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 regardsMartin 解决方案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 wantsyntax: substr(index, count);example:Items->Add(tmp.substr(0, charPos));delete the elemnt you added and repeat that until pos returns an error.--GreetingsWolfgang 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 WolfgangHire a programmer to do it.That''s what we are paid for.--Karl Heinz Buchegger kb******@gascad.at 这篇关于需要帮助C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 23:36