Does VBScript have a substring () function?

Is there a substring() function in VBScript similar to Java string.substring() ?

+45
string vbscript
Feb 08 '10 at 16:55
source share
2 answers

Yes Mid .

 Dim sub_str sub_str = Mid(source_str, 10, 5) 

The first parameter is the source string, the second is the start index, and the third is the length.

@bobobobo: Note that VBScript strings are based on 1, not 0. Passing 0 as the Mid argument results in an โ€œinvalid procedure call or Mid argumentโ€.

+74
Feb 08 '10 at 16:58
source share

As Tmdean correctly pointed out , you can use the Mid() function. The MSDN Library also has a large VBScript help section, which you can find here:

VBScript Language Reference (MSDN Library)

+13
Feb 08 '10 at 17:05
source share



All Articles