Skip to content

Instantly share code, notes, and snippets.

@rootVIII
Last active November 27, 2023 01:11
Show Gist options
  • Save rootVIII/54bd5d2f4f05a1b0e597a666cb97c274 to your computer and use it in GitHub Desktop.
Save rootVIII/54bd5d2f4f05a1b0e597a666cb97c274 to your computer and use it in GitHub Desktop.
Verse slice string and array
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Verse }
using { /UnrealEngine.com/Temporary/Diagnostics }
slice_class := class(creative_device):
Item1 : []string = array{"zero", "one", "two", "three", "four"}
Item2 : string = "string here"
ModifyItem1() : []string =
var Modified : []string = array{}
# Example access element if it exists:
# if (var Item : string = Items2[10]):
# return Item
# if (Item := Items2[10]):
# return Item
# Example append to array (creates new array):
# var Items3 : []string = Items1 + array{"ending"}
# Example remove element:
# if(set Modified = Items1.RemoveElement[2]):
# return Modified
if (set Modified = Item1.Slice[1, 3]){}
return Modified
ModifyItem2() : string =
var X : string = "string here"
var Y : string = ""
if (set Y = X.Slice[2, X.Length]){}
return Y
OnBegin<override>()<suspends>:void =
Print("START- - - - - - - - - - -")
Result1 : []string = ModifyItem1()
for (Entry : Result1):
Print(Entry)
Print("- - - - - - - - - - -")
Result2 : string = ModifyItem2()
Print(Result2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment