jinred Posted January 26, 2007 Share Posted January 26, 2007 Hi I would like to load string from file into array, but i cant use StringSplit couse i haven't delimeter. My temp.txt contains C1B1F300 string, so with simple code: $File = FileOpen("C:\temp.txt", 1) $Read = String(FileRead('C:\temp.txt')) FileClose($File) i can load string, but how to load it into array to get result: $Read[0]=C1 $Read[1]=B1 $Read[2]=F3 $Read[3]=00 Thanks for any help! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 26, 2007 Moderators Share Posted January 26, 2007 (edited) I don't see where you even attempted to try to do it... But it was easy enough:$sString = "C1B1F300" $aArray = _SplitByChar($sString, 2) Func _SplitByChar($sString, $nChars) Local $sHoldReturn = '' For $iCC = 1 To StringLen($sString) Step $nChars $sHoldReturn &= StringMid($sString, $iCC, $nChars) & Chr(1) Next If $sHoldReturn Then Return StringSplit(StringTrimRight($sHoldReturn, 1), Chr(1)) Return SetError(1, 0, '') EndFuncoÝ÷ ØGb´êâ*.Á©í¶è²+µ©Ý²)©æ®¶sbb33c·57G&ærÒgV÷C´3#c3gV÷C°¢b33c¶'&Òõ7ÆD'6%5$Rb33c·57G&ærÂ"¥ô'&F7Æb33c¶'&Âb33²b33² ¤gVæ2õ7ÆD'6%5$Rb33c·57G&ærÂb33c¶ä6'2 &WGW&â7G&æu&VtWb33c·57G&ærÂb33²ç²b33²fײb33c¶ä6'2fײb33·Òb33²Â2¤VæDgVæ0 Edited January 26, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
jinred Posted January 26, 2007 Author Share Posted January 26, 2007 (edited) I don't see where you even attempted to try to do it... But it was easy enoughEasy for you , Thanks you helped me a lot! Edited January 26, 2007 by jinred Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now