Import a string line by line into a listbox

Hello,
My variable returns a string that I need to import line by line into a Listbox.
Next, I need to store the string “date and time” in each Listbox1.RowTagAt(index)).
How to do please ?

Shell1.Execute("tmutil listlocalsnapshots / ") 
ud = Shell1.Result
(see photo)

There is a suite of instructions to deal with strings… named String:

http://documentation.xojo.com/api/data_types/string.html

Hints: look for NthField() or Split()

convert string to datetime object
https://documentation.xojo.com/api/data_types/datetime.html#datetime-fromstring

https://documentation.xojo.com/api/code_execution/for_each...next.html

I’m moving forward, But how do we test the end of the string ? (I have an OutOfBounds Exception)

Var ud, anArray()  As String
Shell1.Execute("tmutil listlocalsnapshots / ") 
ud = Shell1.Result

anArray() = ud.ToArray(EndOfLine)

MessageBox(anArray(0))
MessageBox(anArray(1)), etc.

For i = 0 to len(ud) -1 <-----  OutOfBoud Exception !
  Listbox1.AddRow(anArray(i))
Next

anArray.LastIndex

see also
https://documentation.xojo.com/api/user_interface/desktop/desktoplistbox.html.AddRows
if you have a single column

Yes ! You are my hero of the day !
Thanks

and before the loop
.RemoveAllRows

Unsurprising since you’re asking to add a row for every character in the string. As @MarkusR hints, you want:

For i = 0 to anArray.LastIndex
  Listbox1.AddRow(anArray(i))
Next

Yes sir!