Splitting string based on a given "pattern"

I’m having some trouble splitting string imported from a .kof file, this file is imported as a .txt file in Dynamo. Kof is frequently use by surveyors and contains coordinate information along with some metadata. The data in this kind of file is structured by their position in relation to each other. The points in this file is given by the code 05, and given in this structure: " 05 PPPPPPPPPP KKKKKKKK XXXXXXXX.XXX YYYYYYY.YYY ZZZZ.ZZZ Bk MMMMMMM"

The problems starts when some of the “points” in the file also contains some information in the KKKKKKKK- field and some doesn’t. See the attached screenshots from from the .kof file and Dynamo.

Is there any way Dynamo can use a given “pattern” to split a string and solve a problem like this?
If so is also possible to place ex. “Null” when there isn’t any data in the KKKKKKK field?

S-17329HVL_FM_02_Test.txt (1.7 KB)

kof to point with information.dyn (51.9 KB)

1 Like

Thank you for you help, this kind of solves my problem!

nicked it from @jostein_olsen

Splitting at the new lines and using a string.StartsWith to filter your strings that start with “-05 “ would likely also get you going in the right direction. Would also serve as a matching start for filtering other data as well.

1 Like