Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Format IP address and write to file

$
0
0
This is my input: 1.0.0.0,1.0.0.255,Australia
and this is how my output in test.txt with leading zeros should look like: 001.000.000.000,001.000.000.255,Australia

[ autoit ]      
#include <Array.au3> $text = '1.0.0.0,1.0.0.255,Australia' $atext = StringSplit($text, ",") $file = FileOpen("test.txt", 2) For $i = 1 To 2 $array = StringRegExp($atext[$i], '(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})', 3) For $j = 0 To 3 $k = StringFormat("%03i",$array[$j]) MsgBox(4096, "output", $k) Next    Next FileClose($file)

Where to put and how to use FileWriteLine function?

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>