> For the complete documentation index, see [llms.txt](https://developers.polymath.network/polymath/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.polymath.network/polymath/api/util.md).

# Utility contract for reusable code (Util.sol)

View Source: [contracts/libraries/Util.sol](https://github.com/PolymathNetwork/polymath-core/tree/096ba240a927c98e1f1a182d2efee7c4c4c1dfc5/contracts/libraries/Util.sol)

**Util**

## Functions

* [upper(string \_base)](/polymath/api/util.md#upper)
* [stringToBytes32(string \_source)](/polymath/api/util.md#stringtobytes32)
* [bytesToBytes32(bytes \_b, uint256 \_offset)](/polymath/api/util.md#bytestobytes32)
* [bytes32ToString(bytes32 \_source)](/polymath/api/util.md#bytes32tostring)
* [getSig(bytes \_data)](/polymath/api/util.md#getsig)

### upper

Changes a string to upper case

```javascript
function upper(string _base) internal pure
returns(string)
```

**Arguments**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| \_base | string | String to change |

### stringToBytes32

```javascript
function stringToBytes32(string _source) internal pure
returns(bytes32)
```

**Arguments**

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| \_source | string |             |

### bytesToBytes32

```javascript
function bytesToBytes32(bytes _b, uint256 _offset) internal pure
returns(bytes32)
```

**Arguments**

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| \_b      | bytes   |             |
| \_offset | uint256 |             |

### bytes32ToString

Changes the bytes32 into string

```javascript
function bytes32ToString(bytes32 _source) internal pure
returns(string)
```

**Arguments**

| Name     | Type    | Description                      |
| -------- | ------- | -------------------------------- |
| \_source | bytes32 | that need to convert into string |

### getSig

Gets function signature from \_data

```javascript
function getSig(bytes _data) internal pure
returns(sig bytes4)
```

**Returns**

bytes4 sig

**Arguments**

| Name   | Type  | Description |
| ------ | ----- | ----------- |
| \_data | bytes | Passed data |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.polymath.network/polymath/api/util.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
