How to arrange strings like that?
Hello :)
It's my 2nd day im working on a function to arrange any string in a certain pattern, and after all my efforts im forwarding this query here.
I want to arrange any string like -
Suppose the string is "google" Now i want to arrange them in a listbox as -
g-oogle
go-ogle
goo-gle
goog-le
googl-e
g-o-o-g-l-e
g-o-gle
and so on [all possible patterns (without any duplicate entry)]..
Note: "-" can be many times but shouldn't be duel like "go--ogle"
I hope you can help me on this :)
Thanks
Regards,
Re: How to arrange strings like that?
It is simply a matter of looping and breaking the string into pieces inserting the character.
Show us what you have so far and maybe we can point you in the right direction
Re: How to arrange strings like that?
Hi DataMiser,
It's not as much simple for me..
See this link. It's the demonstration I want to do same in vb6.
Code:
www+exploitn+com/gmail.php
Ok Here I am doing like this-
Code:
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Const LB_FINDSTRINGEXACT = &H1A2
Private Sub AddToListbox(strListBItem As String, LB As ListBox)
Dim lngListIndex As Long
' lngListIndex is the ListIndex if the item is found
lngListIndex = SendMessage(LB.hwnd, LB_FINDSTRINGEXACT, -1, ByVal strListBItem)
If lngListIndex = -1 Then
LB.AddItem strListBItem
Else
DoEvents
Exit Sub
End If
End Sub
Private Sub Command1_Click()
Dim S As String, i As Long, R As String, X As String
S = "google"
For i = 1 To Len(S) - 1
R = Left(S, i) & "." & Right(S, Len(S) - i)
If Right$(R, 1) <> "." Then AddToListbox Replace(R, "..", "."), List1
Next i
Dim J As Long, K As Long
For J = 0 To List1.ListCount - 1
S = List1.List(J)
For i = 1 To Len(S)
R = Left(S, i) & "." & Right(S, Len(S) - i)
X = Replace(R, "..", ".")
'remove duplicates
If Right$(X, 1) <> "." Then AddToListbox X, List1
DoEvents
Next i
Next J
Me.Caption = List1.ListCount
End Sub
But it's generating only 15 entries, and above URL is generating 32 entries.
Thanks
Regards,
Re: How to arrange strings like that?
Sorry but no. I am not going to some web site to see a demo especially not one named exploitn
You say you are on your 2nd days working on this so surely you have written some code. Show us what you have and tell us what problem you are having then maybe we can help.
May also be nice to know why you want to do this as there does not seem to be much in the way of practical use for it.
1 Attachment(s)
Re: How to arrange strings like that?
Okies, I have already modified my last previous post to add my codes. You can check them.. And Ok if you don't want to go to that URL, you check the attached snapshot here.
Attachment 96643
Thanks !
Re: How to arrange strings like that?
Check post #5 in this thread. It should get you there. http://www.vbforums.com/showthread.p...=1#post4301705
Re: How to arrange strings like that?
Is this what you need? Put a command button, a textbox and a listbox on a form....put your string in the textbox and click on the cmdbtn
Code:
private sub Command1_click()
Dim x As Integer, y As Integer, myText As String
myText = Trim(Text1.Text)
y = 0
For x = 1 To Len(myText) - 1
myText = Left(myText, 0 + (y)) & Mid(myText, y + 1, 1) & "," & Mid(myText, y + 2)
List1.AddItem myText
y = y + 2
Next x
End Sub
Re: How to arrange strings like that?
I guess it would be easier for her/him if we would post our EMail directly, instead of having her/him trying to find it by brute-forcing all possible ones. :sarcastic:
Re: How to arrange strings like that?
Quote:
Originally Posted by
SamOscarBrown
Is this what you need? Put a command button, a textbox and a listbox on a form....put your string in the textbox and click on the cmdbtn
Code:
private sub Command1_click()
Dim x As Integer, y As Integer, myText As String
myText = Trim(Text1.Text)
y = 0
For x = 1 To Len(myText) - 1
myText = Left(myText, 0 + (y)) & Mid(myText, y + 1, 1) & "," & Mid(myText, y + 2)
List1.AddItem myText
y = y + 2
Next x
End Sub
That misses many possibilities. Take a look at the list in Post #5.
Re: How to arrange strings like that?
Quote:
Originally Posted by
MarkT
Greetings,
Thanks to all of you for your valuable replies.
Thank you so much MarkT, that URL is perfectly working..
I will try to learn many more with this.
Regards, :)
Re: How to arrange strings like that?
Quote:
Originally Posted by
opus
I guess it would be easier for her/him if we would post our EMail directly, instead of having her/him trying to find it by brute-forcing all possible ones. :sarcastic:
lmao:p:p:p:p:p:p:p:p: they got time for such in life , they want to get rich thats all:eek:this is why they do it:eek::eek:idiots:eek:
Re: How to arrange strings like that?
OH...SO sorry.....didn't read very well, did I. Please accept my apologies for wasting your time.