import { Meta } from '@storybook/addon-docs/blocks'

<Meta title='@dxtmisha/en/functional-basic/Functions/removeCommonPrefix - Remove common prefix'/>

# `removeCommonPrefix`

Removes a common prefix from the beginning of the main string. If the main string starts with the specified prefix, the function trims it and returns the string without leading and trailing whitespaces.

**Parameters:**
- `mainStr: string` — The main string.
- `prefix: string` — The prefix string to remove.

**Returns:**
`string` — A new string without the prefix and trimmed of whitespaces.

```typescript
import { removeCommonPrefix } from '@dxtmisha/functional-basic'

console.log(removeCommonPrefix('Hello, world!', 'Hello, ')) // 'world!'
console.log(removeCommonPrefix('user_name', 'user_')) // 'name'
```
