We were, but I think it just changed to bad cop, bad cop.Quote:
Originally posted by Jethro
SD
Are we playing good cop bad cop, or am l just in one of those moods.
:D
And no it isn't my turn to wear the handcuffs.
SD
Printable View
We were, but I think it just changed to bad cop, bad cop.Quote:
Originally posted by Jethro
SD
Are we playing good cop bad cop, or am l just in one of those moods.
:D
And no it isn't my turn to wear the handcuffs.
SD
Okay folks, gotta dash. The wife has just lured me away from the computer with alchohol!
See ya's tomorrow!
SD
Damn, those things chaff. Ok as long as l get too wear the clean pair of underwear next week.Quote:
Originally posted by SurfDemon
:D
And no it isn't my turn to wear the handcuffs.
SD
Have a couple for me.............still three hours to go before ripping corks:eek:
*psssssst Jethro called steve a girl* pass it on.:eek:
Dont pick on SD he's got Blue tits out of his window man!:p
And i hear now this is just a rumour stevess picks his nose!:)
Takes different strokes guys, (as I remember a little dwarf and his white family say once) ;) you do take on a stifling air of superiority sometimes steve (I'm used to it because of where I work) and most people will generally find offence with it. I guess you'll have to get used to it if you can't change it.Quote:
Originally posted by stevess
scoutt,
Is that the best you could come up with? Jethro was rude to Gaffer, and that influenced my response. But even still, I don't see how Jethro's code helped at all. HE was the first to critisize, not me. And then he reacted with insults because his precious code had been critisized.
He stated that he "knew" the poster and "knew" what he meant. Does that mean that the rest of us should "know" what the poster really means? I don't know who he is, I can only go by the question that was posted.
As for Jethro, I think there may be a case of mistaken identity here - I noticed theres a vbworld member called Gaffa (possibly from Oz?). I'm in Landon Taaaan.
As for the insult? Love it. My avatar expects to receive taunts...
I have had about enough of this - I was gonna post a joke to try and diffuse the situ', I was even gonna try and start a "code off" so you could put your money where your smelly mouth is, but I can't be arsed....I even took the time to register under a different name so that John wouldn't kick me off the forum for what i'm about to say, im not chicken (in fact im hard as nails !!!), but I like the forum, so SteveSS if you want some then lemme know and i'll be on the first flight out there to rip your scrawny angry little head off your scrawny neck you stupid little man!!!!!!
You clearly have a problem, everyone else gets on fine here (mostly ;) )
How can anyone else manage to be so obtuse and rile so many people with so few posts???
I suggest you shut the F*** up, and F*** off to whichever padded cell you came from and keep trying to open your sphincter with that pink crowbar of yours - you stupid ******.
There - happy now :)
Call me CHENKO you butt fu*k !!!:mad:Quote:
Originally posted by stevess
It's nice to see that you all know each other, no wonder I am getting hammered so bad.
Chenko/Simon,
That just shows your immaturity and/or ignorance.
Katie/barrk,
By agreeing, that shows your's too.
Most of you all act like a bunch of children.
And yes, I am ignorant, but only towards people like you, we have seen people like you before here....and we just dont like it
Children? I think most of us are probaly older than you and have more right to make that comment, take nukem996 for example...look at his status...I think if you carry on like this you will be just like him...
Is your aim here to make everyone hate you to get attention?
"stevess_isatwat" WWOOOOOOOO HHHHHHHOOOOOOOOOo:D
For scoutt,
I just wrote this since the code I was referring to is at work, which is where I have to go now.
Simon, I'm 36Code:Public Function InStr2(sString As String, sSearch As String, Optional lStart As Long = 1, Optional bReverse As Boolean = False, Optional lOccurrence As Long = 1, Optional bMatchCase As Boolean = False) As Long
Dim lPos As Long
Dim lCntr As Long
Dim lLength As Long
Dim lSearchLen As Long
Dim sTemp As String
Dim lNum As Long
lLength = Len(Trim$(sString))
lSearchLen = Len(Trim$(sSearch))
If (lLength = 0) Or (lSearchLen = 0) Or (lSearchLen > lLength) Then
InStr2 = 0
Exit Function
End If
If Not bMatchCase Then
sString = UCase$(sString)
sSearch = UCase$(sSearch)
End If
If lSearchLen = 1 Then
If bReverse Then
For lCntr = lLength To 1 Step -1
sTemp = Mid$(sString, lCntr, 1)
If sTemp = sSearch Then
lPos = lLength - (lCntr - 1)
lNum = lNum + 1
If lNum = lOccurrence Then Exit For
End If
Next lCntr
Else
For lCntr = 1 To lLength
sTemp = Mid$(sString, lCntr, 1)
If sTemp = sSearch Then
lPos = lCntr
lNum = lNum + 1
If lNum = lOccurrence Then Exit For
End If
Next lCntr
End If
Else
If bReverse Then
For lCntr = lLength To 1 Step -1
sTemp = Mid$(sString, lCntr, lSearchLen)
If sTemp = sSearch Then
lPos = lLength - (lCntr - 1)
lNum = lNum + 1
If lNum = lOccurrence Then
Exit For
Else
lCntr = lCntr - lSearchLen
End If
End If
Next lCntr
Else
For lCntr = 1 To lLength
sTemp = Mid$(sString, lCntr, lSearchLen)
If sTemp = sSearch Then
lPos = lCntr
lNum = lNum + 1
If lNum = lOccurrence Then
Exit For
Else
lCntr = lCntr + lSearchLen
End If
End If
Next lCntr
End If
End If
If lNum = lOccurrence Then
InStr2 = lPos
Else
InStr2 = 0
End If
End Function
Appologies, Just act like it thenQuote:
Originally posted by stevess
Simon, I'm 36
and ****ING call me chenko!!
Sorry, Chenko.
Code:typedef basic_string<TCHAR> tstring;
tstring _SPRINTF(const TCHAR *pcFormat, ...) {
va_list args;
TCHAR pcBuf[1025];
va_start(args, pcFormat);
_vsntprintf(pcBuf, 1024, pcFormat, args);
va_end(args);
pcBuf[1024] = 0; // Just make sure
return pcBuf;
}
Oops...I missed a .c_str() in the MessageBox code.
SD,
I wrote this in 20 minutes while I was having my morning coffee
this morning. It was just meant to be an example of how InStr could be improved, and it can be improved.
The actual code we used is not mine to give away.
:D
Well doesn't that just prove my earlier point?
You quickly run off code and it's sloppy.
But, as soon as someone else posts sloppy code you leap down their throat. Now, admit it, you didn't like it when I ripped your code apart. So why would you do that to anyone else. It's not a nice thing to do.
I apologise if my comments about your code upset you. I was just trying to make a point (Hell, I've posted some pretty poor code on this site loads of time).
SD
Look at the way this whole thing that you started has blown up, Katie!!
It's all YOUR fault!! muwahahahah :D
stop arguin.... its my bday and your making it bad :(
well crippy, happy b-day Skitchen8 :D
ok everybody stop ragging on stevess so Skitchen8 can have a good b-day.
Thank You finally some peace on the thread... anyways i gotta go to my sis's graduation ceremony soon so ill talk to y'all later
SD,
It doesn't bother me at all to have my code criticized. I will learn from it. I have fixed most of the things you pointed out, but I have a question. You said,
InStr is just a built in function, I would think it must do somthing similar, but I don't know.Quote:
Now, you're looping through the strings instead of using instr ..... wow, this is so inneficient.
I tested this, x = InStr2(sTestStr, "A", lOccurrence:=285000) on a 300,000 character string, and it is almost instant.
Actually, I just tested it on a 3 million character string and it is a lot slower than InStr.
But if I want to find the 5000th occurrence of "X", how can I make it faster?
Latest version:
Code:Public Function InStr2(ByVal sString As String, ByVal sSearch As String, Optional ByVal lStart As Long = 1, Optional ByVal lOccurrence As Long = 1, Optional ByVal bMatchCase As Boolean = False) As Long
'If sSearch is negative, the search will occur from right to left
'and will return the position from the right that the search string starts
Dim lPos As Long
Dim lCntr As Long
Dim lLength As Long
Dim lSearchLen As Long
Dim sTemp As String
Dim lNum As Long
Dim bReverse As Boolean
lLength = Len(sString)
lSearchLen = Len(sSearch)
bReverse = lStart < 0
lStart = Abs(lStart)
If (lLength = 0) Or (lSearchLen = 0) Or (lSearchLen > lLength) Then
InStr2 = 0
Exit Function
End If
If Not bMatchCase Then
sString = UCase$(sString)
sSearch = UCase$(sSearch)
End If
If bReverse Then
For lCntr = lLength To 1 Step -1
sTemp = Mid$(sString, lCntr, lSearchLen)
If sTemp = sSearch Then
lPos = lLength - (lCntr - 1)
lNum = lNum + 1
If lNum = lOccurrence Then Exit For
End If
Next lCntr
Else
For lCntr = 1 To lLength
sTemp = Mid$(sString, lCntr, lSearchLen)
If sTemp = sSearch Then
lPos = lCntr
lNum = lNum + 1
If lNum = lOccurrence Then Exit For
End If
Next lCntr
End If
If lNum = lOccurrence Then
InStr2 = lPos
Else
InStr2 = 0
End If
End Function
Happy Birthday Skitchen8.
Okay, let's just agree that it's not nice to slag off other peoples answers and I'll be happy.:D
I don't have VB on this machine, but this should give what you want for the forward search. Use InstrRev for the backwards search.
The If.. Then statement in the middle isn't really needed as the loop will end eventually, but it might provide a speed increase if you are unsure if there are that many occurences of the search string.
I hope this helps,Code:lPos=0
For lCntr = 1 To lOccurence
lPos = instr(lPos+1,sString, sSearch)
If lPos=0 then
Exit For
End If
Next lCntr
SD
So simple, yet so effective.
When did InStrRev pop up? I can't believe I have never even heard of it.
Thanks, and I'll try to play nice from now on.
Cool. Peace man.
InstrRev came in with VB 6.0 and all the other split functions and the like.
Have fun :D
SD
Stevess you said "I dont know what this code does" right..
well, look at the comments that the person who wrote the code before had typed
"This function accepts as inputs the number of input symbols, an
array where the input symbols are stored and an output array
where the resulting output symbols are stored."
does that answer your question? :p
Actually, that has very little to do with what it does. Honestly, if I tried, even a little, to figure it out I could probably grasp it. My whole point was that it pretty much worked as supllied so I never took the time. It was just a small piece of a large project and I knew that I would probably never use it again.
If someone had just given me the algorithms and said "This is how it works on paper, translate it into code.", I would have been forced to learn exactly what it was doing.
There is a lot more to generating these bar codes, the rest of it I pretty coded myself using a Guide supplied by Australia Post.