22 nd Oct 2014 23:10:24
Hai Friend , Sign In
Home
World
INDIA
Chennai City
Games
Developers
Members
Birthday
IP 2 Location
Search
Astrology
G. K.
Story
Tamil Nadu Government Holiday List 2013 in English and Tamil   *   Trichy: Wanted - PHP, MySql Programmers. Contact trichy people only 9150 170 357.   *   Indian Railways New Train Number List [Search / Enquiry / Locator / Finder]   *   பன்றிக் காய்ச்சல் பற்றி அறிந்து கொள்ளுங்கள் (Swine Flu H1N1)
See Also
InStrRev Function InStrRev Function
String Functions String Functions
Option Compare Statement Option Compare
Visual Basic Functions Visual Basic Functions
Visual Basic Home Visual Basic Home
 
Description  Syntax  Return Datatype  Example  Migration

InStr Function - Visual Basic 6.0 (VB 6.0)

Returns the position of the first occurrence of one string within another.
Syntax:
InStr([start,]string1,string2[,compare])
Parameter Description
start Optional. Numeric expression that sets the starting position for each search. Default 1.
string1 Required. String expression being searched.
string2 Required. String expression searched for.
compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings.


InStr Function's compare argument:
Constants Value Description
vbUseCompareOption -1 Performs a comparison using the setting of the Option Compare statement.
vbBinaryCompare 0 Default. Perform a binary comparison.
vbTextCompare 1 Perform a textual comparison.
vbDatabaseCompare 2 Microsoft Access only. Performs a comparison based on information in your database.
 

Return Data type:
Long
Example:


Dim SearchStr as String, SearchChar as String
SearchStr = "Chennaiiq"
SearchChar = "N"

Statement Result Remark
InStr(1, SearchStr, SearchChar, 1) 4 vbTextCompare
InStr(1, SearchStr, SearchChar, 0) 0 vbBinaryCompare
InStr(5, SearchStr, SearchChar, 1) 5 Second occurrence
InStr(6, SearchStr, SearchChar, 1) 0  
InStr(SearchStr, LCase(SearchChar)) 4  
InStr("", SearchChar) 0  
InStr(4, SearchStr, "") 4 Value of start argument
InStr(Null, SearchChar) Error Invalid use of null
InStr(SearchStr, Null) Error Invalid use of null
Go to top

Migration from Visual Basic 6.0 (VB 6.0) to
  InStr Function in VB Script (VBS)
  InStr Function in JScript (JS)
  InStr Function in ASP (Active Server Page)
  InStr Function in PHP Script
  InStr Function in MS-Access
  InStr Function in MS SQL Server
  InStr Function in Oracle
  InStr Function in C Language
  InStr Function in C++ Language
  InStr Function in Foxpro
  InStr Function in Fortran
  InStr Function in MS Excel Sheet
Go to top
 





© 2005 - 2007 Chennaiiq.com. All Rights Reserved.

Our Sites: ChennaiIQ.com || Tamil Calendar || Tamil Panchangam || KP Astrology
Our Blogs: Tamil Calendar



41