Split Function


Split Function

Class

Microsoft.VisualBasic.Strings

Syntax

     Dim result(  ) As String = Split(expression[, delimiter[, _         limit[, compare]]]) 


expression (required; String)

A string to be broken up into multiple strings.


delimiter (optional; String)

The character used to delimit the substrings in expression. If omitted, the space character is used.


limit (optional; Integer)

The maximum number of strings to return. If omitted, -1 is used, which indicates that no limit is imposed.


compare (optional; CompareMethod enumeration)

Indicates the text comparison method. One of the following Microsoft.VisualBasic.CompareMethod enumeration values:

Value

Description

Binary

Performs a binary (case-sensitive) comparison

Text

Performs a text (case-insensitive) comparison


If omitted, Binary is used.

Description

The Split function splits a string into multiple smaller strings using delimiter to determine where to divide the string, and it returns the results as an array of strings.

Usage at a Glance

  • If expression is a zero-length string, Split returns an empty array.

  • If delimiter is not found in expression, Split returns the entire string in element 0 of the returned array.

  • Once one less than limit has been reached, the remainder of the string is placed, unprocessed, into the final element of the returned array.

  • Strings are written to the returned array in the order in which they appear in expression.

  • The setting of compare impacts how delimiter is compared with the text of expression.

See Also

Join Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net