A problem of parse a string Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
songdg
Posts: 561
Joined: 04 Oct 2017, 20:04

A problem of parse a string

24 Feb 2018, 12:02

09:15 22.87 57900-- 0
09:15 22.87 58000-- 0
09:15 22.87 217700-- 0
09:16 22.87 60600-- 0
09:16 22.87 65000-- 0
09:16 22.87 65500-- 0
09:16 22.87 68300-- 0
09:17 22.87 68000-- 0
data.txt
(392 Bytes) Downloaded 19 times
Normally,each line contains 4 elements separated by 2Tab, I can use word_array := StrSplit(line, " ") to get the elements.But sometimes the line may separated by 1Tab.Is there a way to solve the problem.
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: A problem of parse a string  Topic is solved

24 Feb 2018, 12:19

Code: Select all

fileread, data, data.txt
MsgBox % RegExReplace(data, "\t+","`t")
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: A problem of parse a string

24 Feb 2018, 12:22

replace all 2-tab's with a single tab first then split.
songdg
Posts: 561
Joined: 04 Oct 2017, 20:04

Re: A problem of parse a string

25 Feb 2018, 04:40

Odlanir wrote:

Code: Select all

fileread, data, data.txt
MsgBox % RegExReplace(data, "\t+","`t")
Thank you very much!
songdg
Posts: 561
Joined: 04 Oct 2017, 20:04

Re: A problem of parse a string

25 Feb 2018, 04:41

AlphaBravo wrote:replace all 2-tab's with a single tab first then split.
Thank you very much!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, doodles333, vysmaty and 244 guests