!            Natan
! Natan
CC#
Created by ! Natan on 7/16/2023 in #help
✅ Crazy C# Beahviour
This is a very basic problem that it's getting me mad. Since it doesn't work in this case but on an online c# compiler is works more than fine. So I have this string that I want to split to retrive different datas and this is what I get. Here's the string and the snippet.
string _raw = "1689514251*[37197921;ON;1689514258;12750;tropossu;3,12750;tropossu;1689514250;3|12749;folundo8;1689514245;1|12748;tropossu;1689514238;3|12747;folundo8;1689514233;1|12746;tropossu;1689514227;3|12745;folundo8;1689514222;1|12744;tropossu;1689514215;3|12743;folundo8;1689514210;1|12742;tropossu;1689514203;3|12741;folundo8;1689514198;1]()"

_raw = _raw.Remove(_raw.Length - 3).Split('[')[1] #I Remove before the last 3 chars, I don't need them, and then I split it in two half, i want only the content inside []
string _raw = "1689514251*[37197921;ON;1689514258;12750;tropossu;3,12750;tropossu;1689514250;3|12749;folundo8;1689514245;1|12748;tropossu;1689514238;3|12747;folundo8;1689514233;1|12746;tropossu;1689514227;3|12745;folundo8;1689514222;1|12744;tropossu;1689514215;3|12743;folundo8;1689514210;1|12742;tropossu;1689514203;3|12741;folundo8;1689514198;1]()"

_raw = _raw.Remove(_raw.Length - 3).Split('[')[1] #I Remove before the last 3 chars, I don't need them, and then I split it in two half, i want only the content inside []
Error That I get: System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' Any kind of help would be more than apriciated
118 replies