|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cant solve this.Please helpme I want to split this line: string line = "Davis , Jones, Beckett , Jordan , Kennt " into an array of their trimmed versions: "Davis" "Jones" "Beckett" "Jordan" "Kennt" I've tried several soluctions but none resolves it. Dim linea As String = "Davis , Jones, Beckett , Jordan , Kennt " Dim delimiter As String = "," Dim nombress As String() = linea.Split(delimiter.ToCharArray()) Array.ForEach(nombress, Function(p) p.Trim()) ' does not work Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) Array.ConvertAll(nombress, New Converter(Of String, String)(Function(c) c.Trim())) ' does not work Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) For Each n In nombress n = n.Trim ' does not work Next Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) SIS01 formulated the question :
> I've tried several soluctions but none resolves it. If you wanna try a VB solution, this would be the place. Given what you're trying, I'd suggest you find another venue to post the question. SIS01 explained on 9/7/2010 :
Show quoteHide quote > Hi, If you were using VB this would work> > Please helpme > > I want to split this line: > > string line = "Davis , Jones, Beckett , Jordan , Kennt " > > into an array of their trimmed versions: > > "Davis" > "Jones" > "Beckett" > "Jordan" > "Kennt" > > > I've tried several soluctions but none resolves it. > > Dim linea As String = "Davis , Jones, Beckett , Jordan , Kennt " > Dim delimiter As String = "," > Dim nombress As String() = linea.Split(delimiter.ToCharArray()) > > > > Array.ForEach(nombress, Function(p) p.Trim()) ' does not work > Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) > > > Array.ConvertAll(nombress, New Converter(Of String, String)(Function(c) > c.Trim())) ' does not work > Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) > > > For Each n In nombress > n = n.Trim ' does not work > Next > Array.ForEach(nombress, Function(p) WriteLine("action: -" & p & " - ")) Dim a() As String Dim i As Integer a = Split("Davis , Jones, Beckett , Jordan , Kennt ", ",") For i = 0 To UBound(a) a(i) = Trim(a(i)) Next For i = 0 To UBound(a) Debug.Print ">"; a(i); "<" Next But it appears that you are using some other language. Sorry we'll not be able to help you here. Rdub This group is for VB6 and earlier(VB Classic). VB.Net and all dotnet groups
have either "dotnet" or "vsnet" in the group name. Please use the following group instead: news://news.aioe.org/microsoft.public.dotnet.languages.vb "Nobody" <nob***@nobody.com> wrote in message aioe, the usenet spammers haven...that's what the cowards use. Considering news:i66tg9$qg1$1@speranza.aioe.org... : This group is for VB6 and earlier(VB Classic). VB.Net and all dotnet groups : have either "dotnet" or "vsnet" in the group name. Please use the following : group instead: : : news://news.aioe.org/microsoft.public.dotnet.languages.vb : your support of it, this comes s no surprise. Right....Bill? Well, in VB:
Dim myString as String myString = "Davis , Jones, Beckett , Jordan , Kennt " Dim myStringArray() As String myString = Replace(myString, " ", "" ) 'if you don't want the spaces myStringArray = Split(myString, ",") That's as close as we are going to get to answering your (somewhat nebulous) question. Dick -- Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July 2006. Dick,
Nobody gave him a link to the vb.Net newsgroup. The Op got his answers there, I've also placed a very compressed version like yours in that newsgroup. Cor "DickGrier" wrote in message news:O$vBFq2TLHA.620@TK2MSFTNGP06.phx.gbl... Well, in VB:Dim myString as String myString = "Davis , Jones, Beckett , Jordan , Kennt " Dim myStringArray() As String myString = Replace(myString, " ", "" ) 'if you don't want the spaces myStringArray = Split(myString, ",") That's as close as we are going to get to answering your (somewhat nebulous) question. Dick -- Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net Author of Visual Basic Programmer's Guide to Serial Communications, 4th Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July 2006. "Cor" <Notmyfirstn***@planet.nl> wrote in message Yes they did :-)news:OO3n8M3TLHA.4344@TK2MSFTNGP02.phx.gbl... > Nobody gave him a link to the vb.Net newsgroup. Mike "DickGrier" <dick_grierNOSPAM@msn.com> wrote in message I would not do the replace for the space character. If you do what you're news:O$vBFq2TLHA.620@TK2MSFTNGP06.phx.gbl... > Well, in VB: > > Dim myString as String > myString = "Davis , Jones, Beckett , Jordan , Kennt " > Dim myStringArray() As String > myString = Replace(myString, " ", "" ) 'if you don't want the spaces > myStringArray = Split(myString, ",") suggesting, a name like "Van Halen" would end up being "VanHalen". Instead, do the Split first and then if desired use Trim$() to eliminate leading and trailing spaces. Of course, this means you'd need to trim the spaces on a per-array-element basis, but at least you're not altering the data. -- Mike Did you visit the dotnet group where the OP wrote that.
However, that was not the question (take the time to look at the original message). It reminds me that once somebody asked me where the power on button of his home computer was. I showed him that and than he said: "Yes but if I am not home, how can I then power up that computer" Cor "MikeD" wrote in message news:i68hqm$gk$1@news.eternal-september.org... I would not do the replace for the space character. If you do what you're"DickGrier" <dick_grierNOSPAM@msn.com> wrote in message news:O$vBFq2TLHA.620@TK2MSFTNGP06.phx.gbl... > Well, in VB: > > Dim myString as String > myString = "Davis , Jones, Beckett , Jordan , Kennt " > Dim myStringArray() As String > myString = Replace(myString, " ", "" ) 'if you don't want the spaces > myStringArray = Split(myString, ",") suggesting, a name like "Van Halen" would end up being "VanHalen". Instead, do the Split first and then if desired use Trim$() to eliminate leading and trailing spaces. Of course, this means you'd need to trim the spaces on a per-array-element basis, but at least you're not altering the data. -- Mike
Show quote
Hide quote
"Cor" <Notmyfirstn***@planet.nl> wrote in message What the hell does this have to do with anything?news:eKXaKe#TLHA.3748@TK2MSFTNGP05.phx.gbl... > Did you visit the dotnet group where the OP wrote that. > > However, that was not the question (take the time to look at the original > message). > > It reminds me that once somebody asked me where the power on button of his > home computer was. > > I showed him that and than he said: "Yes but if I am not home, how can I > then power up that computer" > > Cor
Show quote
Hide quote
"MikeD" wrote in message news:i6al96$9eb$1@news.eternal-september.org... What the hell does this have to do with anything?"Cor" <Notmyfirstn***@planet.nl> wrote in message news:eKXaKe#TLHA.3748@TK2MSFTNGP05.phx.gbl... > Did you visit the dotnet group where the OP wrote that. > > However, that was not the question (take the time to look at the original > message). > > It reminds me that once somebody asked me where the power on button of his > home computer was. > > I showed him that and than he said: "Yes but if I am not home, how can I > then power up that computer" > > Cor ------------------------------------------------------------------------- Yes that was I asking myself as well on your reply to Dick. The OP did asked how to get the spaces removed after and before a comma in a CSV string. What if it had been, "van der Bilt, J.m.k ; Jensen, G, ; Du Pen, P. " in a non English language CSV string The same question, which is based on the follow up question from the OP in the dotNet newsgroup. Not relevant for a true developer, he has to solve problems, not all kind of imaginary problems. (Which I had also ones when somebody asked: "Does it also work if a atomic bomb explode above my office?) The Op had already followed the advice from nobody here, my reply was only meant for Dick to inform him especially about his message. Cor \ > (Which I had also ones when somebody asked: "Does it also work if a atomic No, the question is: "If Cor passes gas in his office, will there be any > bomb explode above my office?) survivors?". Show quoteHide quote "Cor" <Notmyfirstn***@planet.nl> wrote in message news:OmcChRCULHA.4980@TK2MSFTNGP04.phx.gbl... > > "MikeD" wrote in message news:i6al96$9eb$1@news.eternal-september.org... > > > > "Cor" <Notmyfirstn***@planet.nl> wrote in message > news:eKXaKe#TLHA.3748@TK2MSFTNGP05.phx.gbl... >> Did you visit the dotnet group where the OP wrote that. >> >> However, that was not the question (take the time to look at the original >> message). >> >> It reminds me that once somebody asked me where the power on button of >> his home computer was. >> >> I showed him that and than he said: "Yes but if I am not home, how can I >> then power up that computer" >> >> Cor > > > What the hell does this have to do with anything? > ------------------------------------------------------------------------- > Yes that was I asking myself as well on your reply to Dick. > > The OP did asked how to get the spaces removed after and before a comma in > a CSV string. > > What if it had been, > > "van der Bilt, J.m.k ; Jensen, G, ; Du Pen, P. " in a non English > language CSV string > > The same question, which is based on the follow up question from the OP in > the dotNet newsgroup. > Not relevant for a true developer, he has to solve problems, not all kind > of imaginary problems. > (Which I had also ones when somebody asked: "Does it also work if a atomic > bomb explode above my office?) > > The Op had already followed the advice from nobody here, my reply was only > meant for Dick to inform him especially about his message. > > Cor > \
Show quote
Hide quote
"Cor" <Notmyfirstn***@planet.nl> wrote in message Just STFU and go away already. It takes more work to figure out what you news:OmcChRCULHA.4980@TK2MSFTNGP04.phx.gbl... : ------------------------------------------------------------------------- : Yes that was I asking myself as well on your reply to Dick. : : The OP did asked how to get the spaces removed after and before a comma in a : CSV string. : : What if it had been, : : "van der Bilt, J.m.k ; Jensen, G, ; Du Pen, P. " in a non English : language CSV string : : The same question, which is based on the follow up question from the OP in : the dotNet newsgroup. : Not relevant for a true developer, he has to solve problems, not all kind of : imaginary problems. : (Which I had also ones when somebody asked: "Does it also work if a atomic : bomb explode above my office?) : : The Op had already followed the advice from nobody here, my reply was only : meant for Dick to inform him especially about his message. are saying than anything else. And even then you make little to no sense. On Tue, 7 Sep 2010 20:08:22 -0500, "SIS01" <si***@msf.org.mx> wrote: ¤ Hi,¤ ¤ Please helpme ¤ ¤ I want to split this line: ¤ ¤ string line = "Davis , Jones, Beckett , Jordan , Kennt " ¤ ¤ into an array of their trimmed versions: ¤ ¤ "Davis" ¤ "Jones" ¤ "Beckett" ¤ "Jordan" ¤ "Kennt" ¤ ¤ ¤ I've tried several soluctions but none resolves it. ¤ ¤ Dim linea As String = "Davis , Jones, Beckett , Jordan , Kennt " ¤ Dim delimiter As String = "," ¤ Dim nombress As String() = linea.Split(delimiter.ToCharArray()) ¤ Try posting your question to the Visual Basic General forum: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1 Paul ~~~~ Microsoft MVP (Visual Basic) | Try posting your question to the Visual Basic General forum: It was answered yesterday in the VB.Net| | http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1 | group. If you're going to hang directing people to MS forums, you could at least follow what's happening on Usenet. (I know the VB.Net group is "no longer supported" by MS. But it's being used, so your posts are becoming out of touch.) On Thu, 9 Sep 2010 10:04:11 -0400, "Mayayana" <mayayana@invalid.nospam> wrote: ¤ ¤ | Try posting your question to the Visual Basic General forum: ¤ | ¤ | http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1 ¤ | ¤ ¤ It was answered yesterday in the VB.Net ¤ group. If you're going to hang directing people ¤ to MS forums, you could at least follow what's ¤ happening on Usenet. (I know the VB.Net ¤ group is "no longer supported" by MS. But it's ¤ being used, so your posts are becoming out ¤ of touch.) ¤ I don't need to know what is going on in other support newsgroups or forums and I'm certainly not going to check them. The forum link was posted as an alternative resource, one with considerably more activity I might add, and it's rather petty to quibble about it. If you're inviting me to continue on in this newsgroup after Microsoft has shut down their servers (within the next month), then I appreciate the thought. Paul ~~~~ Microsoft MVP (Visual Basic) "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message Still the same old troll.news:11mh865798vqhh4ns3655oetlsnvh9s6jj@4ax.com... > Try posting your question to the Visual Basic General forum: > http://social.msdn.micro$oft.com/PlayRoomForums/en-US/vbgeneral/threads?page=1 On Thu, 9 Sep 2010 15:34:16 +0100, "Mike Williams" <M***@WhiskyAndCoke.com> wrote: ¤ Still the same old troll.¤ That you are. Thanks for the reminder. ;-) Paul ~~~~ Microsoft MVP (Visual Basic) Paul,
Will you be so kind next time to add a text like "non VB6" questions (or whatever text). I become sad of redirecting (if this newsgroup is not in a bad acting mood) all forum post for VB6 again to this newsgroup. You know, your text comes in search engines. Cor "Paul Clement" wrote in message news:11mh865798vqhh4ns3655oetlsnvh9s6jj@4ax.com... ¤ Hi,On Tue, 7 Sep 2010 20:08:22 -0500, "SIS01" <si***@msf.org.mx> wrote: ¤ ¤ Please helpme ¤ ¤ I want to split this line: ¤ ¤ string line = "Davis , Jones, Beckett , Jordan , Kennt " ¤ ¤ into an array of their trimmed versions: ¤ ¤ "Davis" ¤ "Jones" ¤ "Beckett" ¤ "Jordan" ¤ "Kennt" ¤ ¤ ¤ I've tried several soluctions but none resolves it. ¤ ¤ Dim linea As String = "Davis , Jones, Beckett , Jordan , Kennt " ¤ Dim delimiter As String = "," ¤ Dim nombress As String() = linea.Split(delimiter.ToCharArray()) ¤ Try posting your question to the Visual Basic General forum: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1 Paul ~~~~ Microsoft MVP (Visual Basic)
create desktop shortcut when app installed w/P&D installer for XP,Vista,W7
Any "quirsk" with the timer control DLL fight What Is the User Path for Deployment Similar to $(AppPath)? Looking for VC6 newsgroup Error 481 Invalid picture Global class and WithEvents Error 5: ERROR_ACCESS_DENIED when accessing registry in Windows 7 Closing Grouped instances in the taskbar Componenet not installed correctly by PDW |
|||||||||||||||||||||||