<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md) &gt; [removeSuffix](./ibm-cloud-sdk-core.removesuffix.md)

## removeSuffix() function

Removes a given suffix if it exists.

**Signature:**

```typescript
export declare function removeSuffix(str: string, suffix: string): string;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

str


</td><td>

string


</td><td>

the base string to operate on


</td></tr>
<tr><td>

suffix


</td><td>

string


</td><td>

the suffix to remove, if present


</td></tr>
</tbody></table>
**Returns:**

string

the substring of "str" that remains after the suffix is removed

