From 69fe07fb117710f48c77161be63aea884eec64fb Mon Sep 17 00:00:00 2001 From: Ruri Date: Wed, 6 Apr 2022 21:01:09 +0200 Subject: [PATCH] Added CharAt block Closes #685 --- RuriLib/Blocks/Functions/StringFunctions/Methods.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RuriLib/Blocks/Functions/StringFunctions/Methods.cs b/RuriLib/Blocks/Functions/StringFunctions/Methods.cs index 1cdfd864e..d869888a0 100644 --- a/RuriLib/Blocks/Functions/StringFunctions/Methods.cs +++ b/RuriLib/Blocks/Functions/StringFunctions/Methods.cs @@ -210,5 +210,14 @@ public static List Split(BotData data, [Variable] string input, string s data.Logger.Log($"Split the string into {split.Count}", LogColors.YellowGreen); return split; } + + [Block("Gets the character at a specific index")] + public static string CharAt(BotData data, [Variable] string input, int index) + { + var character = input[index].ToString(); + data.Logger.LogHeader(); + data.Logger.Log($"The character at index {index} is {character}", LogColors.YellowGreen); + return character; + } } }