Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は次の String を持っています:
def s="txtimgtxtvdd"
次のように上記の文字列からリストを抽出したい
def l=["txt","img","txt","vdd"]
連続する 3 文字ごとにリストの項目
使用できますcollate(そしてtoList文字列を文字のリストに分割します)
collate
toList
def part = 'txtimgtxtvdd'.toList().collate( 3 )*.join() assert part == ['txt', 'img', 'txt', 'vdd']