Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Diff between Mid and Mid$, Instr and Instr$ ?

Status
Not open for further replies.

dtqui

Programmer
Sep 25, 2000
62
SG
Hi,

I would like to know what is the difference between Mid and Mid$ in VB5? The help in VB5 only talks about the Mid. What's with all the dollar sign in Instr$, Left$, Right$ etc..

If I only use all the functions without dollar sign, would I face problems when I migrate my software from VB5 to VB6?

Thanks.
 
Use of the $ will result in a string type variable, without it, it will return a variant type. Use of the $ will result in quicker calculations and less memory usage.
David Paulson


 
dpaulson is correct. Function without the $ will return a variant data type and placing the $ on the command will force the function to return a string data type. Forcing the function to use a string rather than a variant will cause the command to run 5-7 times faster.
- Jeff Marler B-)
 
Thks for the replies. Now I know better. :-s
 
It makes a difference in VB6 CPU time although I don't see the $ mentioned in the DOC. Use Left$, Right$, Mid$, Ucase$, Lcase$, Trim$, Ltrim$, Rtrim$, Join$ and Replace$.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top