Forum Discussion
Hi,
you can use below function to phrase your text input, there couple of ways to remove the date and time.
1. As NisHera said using Reg Exp, This is more accurate
2. As Marsh_R said, delete using the index property.
function convertTime() { var sampleString = aqFile.ReadWholeTextFile("D:\\CommunityDay\\sample.txt",20); aqString.ListSeparator = ","; if(sampleString != "") { for(var i = 0 ; i < aqString.GetListLength(sampleString) ; i++) { //if(Rgular expression match for date format) //{ Log.Message(aqString.GetListItem(sampleString,i)); //} } } }
- tristaanogre7 years agoEsteemed Contributor
Considering the file is formatted much like a CSV, you could use DDT.CSVDriver to read out the values of the file and then rewrite them to a new file, making sure that, when you write the date column that you just leave it blank.
You could use aqFile.OpenTextFile to open the file and then, in a while loop on EOF, read each line, use aqString.GetListItem as mentioned before to parse out the date, and then re-write the file.
Any one of these methods would work just as well as any other. Personally, I don't like regular expressions so, since the file has a structure that allows it, the GetListItem or CSV method would be my preferred ways.
Related Content
Recent Discussions
- 2 hours agoashly