# How does one index/split/splice strings in OCaml like we do in Python?

**URL:** <https://discuss.ocaml.org/t/how-does-one-index-split-splice-strings-in-ocaml-like-we-do-in-python/4661>\
**Category:** Learning\
**Created:** [November 9, 2019, 12:51am UTC](https://discuss.ocaml.org/t/how-does-one-index-split-splice-strings-in-ocaml-like-we-do-in-python/4661 "2019-11-09T00:51:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rene\_sax](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@rene\_sax](https://discuss.ocaml.org/u/rene_sax)\
**Post date:** [November 9, 2019, 12:51am UTC](https://discuss.ocaml.org/t/how-does-one-index-split-splice-strings-in-ocaml-like-we-do-in-python/4661/1 "2019-11-09T00:51:16Z")

</div>

I want to do:

```auto
"abc"[1:2]

```

to get

```auto
"bc"

```

---

<div class="post-metadata">

**Author:** ![Chet\_Murthy](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/chet_murthy/32/1501_2.png) [@Chet\_Murthy](https://discuss.ocaml.org/u/Chet_Murthy)\
**Post date:** [November 9, 2019, 2:06am UTC](https://discuss.ocaml.org/t/how-does-one-index-split-splice-strings-in-ocaml-like-we-do-in-python/4661/2 "2019-11-09T02:06:17Z")

</div>

```auto
# String.sub "abc" 1 2 ;;
- : string = "bc"

```
