Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

VBScript Split Function

VBScript Split Function


VBScript reference manual Complete VBScript Reference Manual


The Split function returns a zero-based one-dimensional array containing a specified number of substrings.

Syntax

Split(expression[,delimiter[,count[,compare]]])

Parameters Description
expression Required. A string expression containing the substrings and the delimiter.
delimiter Optional. The character used to identify the boundaries of the substrings. The default is the space character.
count Optional. The number of substrings to be returned. -1 indicates that all substrings are returned.
compare Optional. Specifies the type of string comparison to use.

The following values can be used:

  • 0 = vbBinaryCompare - Performs a binary comparison
  • 1 = vbTextCompare - Performs a textual comparison
  • |

    Example

    Example 1

    The example above produces the following output:

    RUNOOB

    is

    my

    favourite

    website

    Try it »

    Example 2

    Split text using the delimeter parameter:

    The example above produces the following output:

    Brown cow

    White horse

    Yellow chicken

    Try it »

    Example 3

    Split text using the delimeter parameter and the count parameter:

    The example above produces the following output:

    RUNOOB

    is my favourite website

    Try it »

    Example 4

    Split text using the delimeter parameter with a text comparison:

    The example above produces the following output:

    Sun

    Mon

    Tues

    WEDNES

    Thurs

    Fri

    Satur

    Try it »

    Example 5

    Split text using the delimeter parameter with a binary comparison:

    The example above produces the following output:

    Sun

    Mon

    Tues

    WEDNESDAYThurs

    Fri

    Satur

    Try it »


    VBScript reference manual Complete VBScript Reference Manual