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

</div>

Method

# AscB

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

<div class="warning">

<div class="title">

Warning

</div>

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

</div>

## Description

Returns as an `Integer</api/data_types/integer>`, the value for the first byte of a `String</api/data_types/string>`.

## Usage

*result*=**AscB**(*string*)

**OR**

Introduced 5.0*result*=*stringVariable*.**AscB**

| Part           | Type                               | Description                                            |
|----------------|------------------------------------|--------------------------------------------------------|
| result         | `Integer</api/data_types/integer>` | The value of the first character of *string*.          |
| string         | `String</api/data_types/string>`   | Any valid `string</api/data_types/string>` expression. |
| StringVariable | `String</api/data_types/string>`   | Any variable of type `String</api/data_types/string>`. |

## Notes

The <span class="title-ref">AscB</span> function returns the code for the first byte in the `String</api/data_types/string>` passed. If you need to get the character code of the first character of the string rather than the first byte, use the `Asc</api/math/asc>` function.

AscB should be used instead of `Asc</api/math/asc>` when the string represents binary data or when your application will run on a one-byte character set (such as the US system) and you want case-sensitivity.

## Sample code

This example uses the <span class="title-ref">AscB</span> to get the value of the first byte of the `string</api/data_types/string>` passed.

``` xojo
MsgBox Str(AscB("a")) ' returns 97
MsgBox Str(AscB("A")) ' returns 65
```

## Compatibility

All project types on all supported operating systems.

## See also

`Asc</api/math/asc>`, `String.ChrByte<string.chrbyte>`, `String.IndexOfBytes<string.indexofbytes>`, `String.LeftBytes<string.leftbytes>`, `String.Bytes<string.bytes>`, `String.MiddleBytes<string.middlebytes>`, `String.RightBytes<string.rightbytes>` functions.
