Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Imperceptus on October 20, 2004, 02:38 PM

Title: Which is Faster?
Post by: Imperceptus on October 20, 2004, 02:38 PM
Which is faster?
sqlCommand = Mid(sqlCommand, 1, Len(sqlCommand) - 2) & ")"
or
sqlCommand = Left(sqlCommand, Len(sqlCommand) - 2) & ")"
Title: Re: Which is Faster?
Post by: UserLoser. on October 20, 2004, 06:13 PM
Never looked into it, but probably Left().  Mid() requires has more parameters, and has to check the start position, while Left() will always use the first character as the start position
Title: Re: Which is Faster?
Post by: Grok on October 20, 2004, 07:34 PM
Use Left$ instead of Left, Mid$ instead of Mid, and + instead of &, since you know for a fact you are working with strings, VB can remove all the extra crap for variants.