# Any way to slice a string by index?

**URL:** <https://forums.unrealengine.com/t/any-way-to-slice-a-string-by-index/1169221>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [May 17, 2023, 11:35pm UTC](https://forums.unrealengine.com/t/any-way-to-slice-a-string-by-index/1169221 "2023-05-17T23:35:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rootVIII](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rootVIII](https://forums.unrealengine.com/u/rootVIII)\
**Post date:** [May 17, 2023, 11:35pm UTC](https://forums.unrealengine.com/t/any-way-to-slice-a-string-by-index/1169221/1 "2023-05-17T23:35:35Z")

</div>

Does Verse support any way to slice a string?

For example in Python and Javascript

```auto
>>> item = 'string here'
>>> item[2:]
'ring here'

```

```auto
> const item = 'string here'
> item.slice(2)
'ring here'

```

I am able to do something similar with the Slice function and arrays:

```auto
Items : []string = array{"zero", "one", "two", "three", "four"}
var Modified : []string = array{}
if (set Modified = Items.Slice[1, 3]){}

```

---

<div class="post-metadata">

**Author:** ![rootVIII](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rootVIII](https://forums.unrealengine.com/u/rootVIII)\
**Post date:** [May 18, 2023, 12:11am UTC](https://forums.unrealengine.com/t/any-way-to-slice-a-string-by-index/1169221/2 "2023-05-18T00:11:28Z")

</div>

Edit: never mind… that same technique works for strings

```auto
var X : string = "string here"
var Y : string = ""
if (set Y = X.Slice[2, X.Length]){}
Print(Y)

```

(Prints ‘ring here’)

---

<div class="post-metadata">

**Author:** ![Flak](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/flak/32/769441_2.png) [@Flak](https://forums.unrealengine.com/u/Flak)\
**Post date:** [May 22, 2023, 12:13pm UTC](https://forums.unrealengine.com/t/any-way-to-slice-a-string-by-index/1169221/3 "2023-05-22T12:13:21Z")

</div>

Glad you got it sorted!
