---
description: >-
  https://stackoverflow.com/questions/5631384/remove-everything-after-a-certain-character
---

# Remove everything after a certain character remove replace (ok)

## [Remove everything after a certain character](https://stackoverflow.com/questions/5631384/remove-everything-after-a-certain-character)

```
var s = '/Controller/Action?id=11112&value=4444';
s = s.substring(0, s.indexOf('?'));
document.write(s);
// /Controller/Action
```
