# Stackdriver Trace V2 Client - Class TruncatableString (2.0.0)

2.0.0 (latest) 2.0.0-RC1 1.9.5 1.8.10 1.7.0 1.6.5 1.5.3 1.4.11 Reference documentation and code samples for the Stackdriver Trace V2 Client class TruncatableString.

Represents a string that might be shortened to a specified length.

Generated from protobuf message `google.devtools.cloudtrace.v2.TruncatableString`

## Namespace

Google \\ Cloud \\ Trace \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ value` | `string` The shortened string. For example, if the original string is 500 bytes long and the limit of the string is 128 bytes, then `value` contains the first 128 bytes of the 500-byte string. Truncation always happens on a UTF8 character boundary. If there are multi-byte characters in the string, then the length of the shortened string might be less than the size limit. |
| `↳ truncated_byte_count` | `int` The number of bytes removed from the original string. If this value is 0, then the string was not shortened. |

### getValue

The shortened string. For example, if the original string is 500
bytes long and the limit of the string is 128 bytes, then
`value` contains the first 128 bytes of the 500-byte string.

Truncation always happens on a UTF8 character boundary. If there
are multi-byte characters in the string, then the length of the
shortened string might be less than the size limit.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setValue

The shortened string. For example, if the original string is 500
bytes long and the limit of the string is 128 bytes, then
`value` contains the first 128 bytes of the 500-byte string.

Truncation always happens on a UTF8 character boundary. If there
are multi-byte characters in the string, then the length of the
shortened string might be less than the size limit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTruncatedByteCount

The number of bytes removed from the original string. If this
value is 0, then the string was not shortened.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setTruncatedByteCount

The number of bytes removed from the original string. If this
value is 0, then the string was not shortened.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |