-
Jan 17th, 2008, 04:40 PM
#1
Thread Starter
Member
[RESOLVED] Delete parts of a string.
Translated:
Hello first off, I've only been begun with VB 6.0 and have a problem -- I hope that I can get help here.
My problem is that I want to delete a part from a string and then put the remaining part into a textbox.
ws.GetData sData
My socket writes the data into sData like this, but I needs to be checked to see if it begins with "abc123 -" and then delete the abc123 part and write the rest into a text box. I have already searched everywhere on the net but nothing with the correct usage... I don't know how to split things out and even a tutorial was of no use (LOL!). I would be grateful for any help.
Greetz Kaikou
(thanks to Comintern for translating)
Original:
Hallo erstmals, ich habe vor ein paar tagen angefangen mit VB 6.0 und habe nun ein problem ^^ ich hoffe das mir hier geholfen wird.
Mein problem ist, das ich teile von einem string löschen will und den nicht gelöschten teil in einer textbox reinschreiben lassen.
ws.GetData sData
Mein socket bekommt also daten die in sData reingeschrieben werden. die sData sind unbekannt allerdings sollte es überprüfen ob der string mit "abc123-" anfängt und den teil abc123- löscht und den rest in eine textbox schreibt. ich hab schon überall im netzt gesucht konnte aber nichts so richtig gebrauchen... kenn mich mit dem Split zeugs nicht so aus und selbst ein tutorial hat da nix gebracht (LOL!). Wäre dankbar für jede hilfe.
Gruss Kaikou ^^
Last edited by Kaikou; Jan 18th, 2008 at 06:54 AM.
Reason: German -> English
-
Jan 17th, 2008, 07:04 PM
#2
Re: teile von einem string löschen
Willkommen ins VB Forums. Erstmals, Englisch ist die Sprache des Forums. Ich habe ein bissen deutsch, aber nur ein bissen. Versuchen Sie diesen Code:
Code:
If Left$(sData, 8) = "abc123 -" Then
If Len(sData) > 8 Then
TextBox1.Text = Right$(sData, Len(sData) - 8)
Else
TextBox1.Text = vbNullString
End If
End If
oder:
Code:
sData = Replace$(sData, "abc123 -", vbNullString)
Translation:
Originally Posted by Kaikou (roughly)
Hello first off, I've only been begun with VB 6.0 and have a problem -- I hope that I can get help here.
My problem is that I want to delete a part from a string and then put the remaining part into a textbox.
ws.GetData sData
My socket writes the data into sData like this, but I needs to be checked to see if it begins with "abc123 -" and then delete the abc123 part and write the rest into a text box. I have already searched everywhere on the net but nothing with the correct usage... I don't know how to split things out and even a tutorial was of no use (LOL!). I would be grateful for any help.
Originally Posted by Comintern
Welcome to VB Forums. First of all, English is the language of this forum. I know a little German, but only a little bit. Try this code:
Code:
If Left$(sData, 8) = "abc123 -" Then
If Len(sData) > 8 Then
TextBox1.Text = Right$(sData, Len(sData) - 8)
Else
TextBox1.Text = vbNullString
End If
End If
or:
Code:
sData = Replace$(sData, "abc123 -", vbNullString)
Last edited by Comintern; Jan 17th, 2008 at 09:23 PM.
Reason: Add translation :)
-
Jan 17th, 2008, 08:56 PM
#3
Re: teile von einem string löschen
As I think Comintern said this is an English-language forum so please only post your questions and answers in English. We use English because VB Forums has a world-wide audience and English is the language that is likely to be understood by the most people.
-
Jan 18th, 2008, 06:48 AM
#4
Thread Starter
Member
Re: teile von einem string löschen
Thanks, this code works GREAT!!
-
Jan 18th, 2008, 07:32 AM
#5
Re: Delete parts of a string.
Welcome to the forums.
If you consider this resolved, you could help us out by pulling down the Thread Tools menu and clicking the Mark Thread Resolved menu item. That will let everyone know that you have your answer.
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|