<div class="meta" robots="noindex">

</div>

Method

# SplitB

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `String.SplitBytes<string.splitbytes>` as a replacement.

</div>

## Description

Creates a one-dimensional array from the `String</api/data_types/string>` passed. <span class="title-ref">SplitB</span> is identical to `String<string.split>`, except that it treats the source as binary data.

## Usage

*result*=**SplitB**(*source*\[,*delimiter*\])

**OR**

*source*.**SplitB**(\[*delimiter*\])

| Part      | Type                                   | Description                                                                                                                            |
|-----------|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| result    | `String</api/data_types/string>` array | Array resulting from breaking *source* into elements using *delimiter* as the field delimiter.                                         |
| source    | `String</api/data_types/string>`       | Source string to be parsed into an array.                                                                                              |
| delimiter | `String</api/data_types/string>`       | Optional field delimiter used to parse *Source* into array elements. If *delimiter* is omitted, then a space is used as the delimiter. |

## Notes

Use the <span class="title-ref">SplitB</span> function to create a new `String</api/data_types/string>` array from a list of elements (or fields) that are separated by a delimiter. If the optional parameter, delimiter, is not passed, a single space is assumed as the delimiter. If the delimiter is an empty string, the source string is split into characters.

According to [issue 16190](https://tracker.xojo.com/xojoinc/xojo/-/issues/16190), <span class="title-ref">SplitB</span> may not work in all cases as documented here. For instance, if the application is localized for Japanese, <span class="title-ref">SplitB</span> returns an empty array when splitting by an empty string. To be on the safe side until this has been fixed, consider assigning the string to a MemoryBlock variable and access its bytes through that instead.

## Sample code

The first example specifies the comma delimiter and the second example uses the default delimiter. They place each field into an array element, producing a three-element array. The last example parses the string into individual characters.

``` xojo
Dim anArray(-1) As String
anArray = SplitB("Adam,Aardvark,Accountant", ",")
anArray = SplitB("Adam Aardvark Accountant")
anArray = SplitB("Adam", "")
' First two using the alternate syntax:
Dim s As String
s = "Adam,Aardvark,Accountant"
anArray = s.SplitB(",") ' produces 3-element array
anArray = s.SplitB("") ' produces array of individual characters, but should be avoided for some encodings such as Japanese
```

## Compatibility

All project types on all supported operating systems.

## See also

`String</api/data_types/string>` data type; `Dim</api/language/dim>` statement; `Array</api/language/array>`, `MemoryBlock</api/language/memoryblock>`, `String<string.fromarray>`, `MemoryBlock</api/language/memoryblock>`, `Arrays<arrays.lastindex>` functions; `Arrays<arrays.add>`, `Arrays.IndexOf<arrays.indexof>`, `Arrays<arrays.addat>`, `Arrays.Pop<arrays.pop>`, `Redim</api/language/redim>`, `Arrays<arrays.removeat>`, `Shuffle</api/language/shuffle>`, `Sort<arrays.sort>`, `Arrays.Sortwith<arrays.sortwith>` methods; `ParamArray</api/language/paramarray>` keyword; `Arrays</api/language/arrays>` concept
