DIAdem Help

Method: InStrB for VBS

  • Updated2024-09-12
  • 2 minute(s) read

Method: InStrB for VBS

Specifies the byte position in the text where a character or a character string appears in the text for the first time.

vInStrB = Object.InStrB(start, string, string2, [compare])
ObjectVBS
Object with this method. You do not need to specify this object.
startVariant
Specifies the start position of the search. If you do not specify start, the search starts with the first character. If you specify compare, you must also specify start. If you do not specify compare, you need not specify start.
stringVariant
Specifies the text you want to search through.
string2Variant
Specifies the character string you want to search for.
[compare]Variant
Specifies the type of comparison. Possible settings are vbBinaryCompare and vbTextCompare. If you do not specify compare, the InStrB method performs a binary comparison.
vInStrBVariant
Receives the position of a character or a character string in a text. Possible return values:
ConditionReturn value
string is an empty string0
string or string2 is NullNull
string2 is an empty string1
string2 is not in string0
string2 is in stringByte position of string2
start is greater than the length of string0

The following example searches a text in various character strings:

Dim MyPos
MyPos = InStrB("abcdabcde", "c")	'Returns 5
Call MsgBox(MyPos) 
MyPos = InStrB("abcdabcde", "C")     'Returns 0
Call MsgBox(MyPos)

See Also

Objects Overview

Related Topics

Filter | InStr | InStrB | InStrRev | Join | LCase | Left | LeftB | Len | LenB | LTrim | Mid | MidB | Replace | Right | RightB | RTrim | Space | Split | StrComp | String | StrReverse | Trim | UCase