breakup LONG string with delimiters?

what function/subroutine could you write to make this work?
or what could you do to accomplish the same thing?

set long_string to “aaaa aa aaaaa_aaaaa aaaa a_aaaaaaa_aaaaaaaaa_aaa_aaaaa_a_aaaaaa”

set one_string to {}

repeat with i to 8 --i will know how many parts are in the string
set the end of one_string to nthfield(long_string,i,“_”)
end repeat

on nthfield
–nthfield(what ever the source is, what ever “field” your working with, the delimiter as string)
end nthfield

any ideas? this is driving me insane! :x

Do you wish

{"aaaa aa aaaaa", "aaaaa aaaa a", "aaaaaaa", "aaaaaaaaa", "aaa", "aaaaa", "a", "aaaaaa"}

as a result of input

"aaaa aa aaaaa_aaaaa aaaa a_aaaaaaa_aaaaaaaaa_aaa_aaaaa_a_aaaaaa"

Then you need TIDs!:

set long_string to "aaaa aa aaaaa_aaaaa aaaa a_aaaaaaa_aaaaaaaaa_aaa_aaaaa_a_aaaaaa"
set AppleScript's text item delimiters to "_"
set one_string to long_string's text items
set AppleScript's text item delimiters to {""}
one_string --> {"aaaa aa aaaaa", "aaaaa aaaa a", "aaaaaaa", "aaaaaaaaa", "aaa", "aaaaa", "a", "aaaaaa"}

Thanks alot dude! :wink:

this community helps me out so much :smiley: