Search the Community
Showing results for tags 'Split'.
-
$input = $CmdLine[1] $bytes = 1000000 ; 1000000 for 1 MB, 1000 for 1 KB $size = FileGetSize($input) $file = fileopen($input, 16) $max = ceiling($size / $bytes) for $i = 1 to $max $data = fileread($file, $bytes) $output = $input & '_' & $i & 'of' & $max filewrite($output, $data) next ^file split file path for a 20MB "video.mp4" is input, it will be output as "video.mp4_1of20", "video.mp4_2of20", etc. change $bytes to affect the split files size, this example made them 1MB (10^6 bytes) $input = $CmdLine[1] $name = stringtrimright($input, 1 + stringlen($input) - stringinstr($input, '_', 0, -1)) $split = stringsplit($input, 'of', 3) $max = $split[ubound($split) - 1] for $i = 1 to $max $in = $name & '_' & $i & 'of' & $max $file = fileopen($in, 16) $data = fileread($file) fileclose($file) filedelete($in) filewrite($name, $data) next ^ file join file path for any of the "video.mp4_Xof20" segments is input. the "video.mp4_Xof20" segments are read and written to "video.mp4" and then deleted, leaving the newly joined "video.mp4" in the end i made this today because i had a big file that i couldn't really open. i split it into 1000 chunks to make processing and stuff easier. i've also used it to split files to just under 25MB segments so i can attach and mail big files over gmail which is silly but it worked
-
hello evrybody here is an example about how to split your texts using a delimiter with the ability to select how much of delimiters shows in each colum with $i_number e.g you have a long text and you want to split it in an array that evry colum have a number (n) of lines i made a function that do that for you just call it with a three params $s_text your text $i_number the number that you want to put in each col $s_siparator the siparator default is "|" here is the function with example i hope that it will be useful for you **** #include <Array.au3> $s_txt = "some text1some text2|some text3|some text4|some text5|some text6" $array = splitText($s_txt, 2) _ArrayDisplay($array) Func splitText($s_text, $i_number, $s_siparator = "|") Local $a_TXT = StringSplit($s_text, $s_siparator) Local $a_Return[$a_TXT[0] + 1] If ($a_TXT[0] <= $i_number) Or ($i_number <= 0) Then ReDim $a_Return[2] $a_Return[0] = 1 $a_Return[1] = $s_text Return $a_Return EndIf Local $i_Processed = 1, $i_arrayProcessed = 1 Do For $i = $i_Processed To ($i_Processed + $i_number) - 1 If ($a_TXT[0] < $i) Then ExitLoop If Not ($a_Return[$i_arrayProcessed]) Then $a_Return[$i_arrayProcessed] = $a_TXT[$i] Else $a_Return[$i_arrayProcessed] &= $s_siparator & $a_TXT[$i] EndIf $i_Processed += 1 Next $i_arrayProcessed += 1 Until ($a_TXT[0] < $i_Processed) ReDim $a_Return[$i_arrayProcessed] $a_Return[0] = $i_arrayProcessed - 1 Return $a_Return EndFunc ;==>splitText accept my greetings thanks to @Dan_555 for his notes
-
Inspired by PHP's preg_split. Split string by a regular expression. Also supports the same flags as the PHP equivalent. v1.0.1 Example: #include "StringRegExpSplit.au3" StringRegExpSplit('splitCamelCaseWords', '(?<=\w)(?=[A-Z])') ; ['split', 'Camel', 'Case', 'Words']
-
hello sirs i've some questions about StringRegExpReplace i hope you can help me i tried to make a function that give me the host of the url and other give me the url with out host for example i've this link https://www.example.com/vb/result.php i need the first give me the example.com and the other give me /vb/result.php i find that $s_source = "https://www.google.com/vb/index.php" Local $s_Host = StringRegExpReplace($s_Source, '.*://(.*?)/.*', '\1') Local $s_Page = StringRegExpReplace($s_source, '.*://.*?(/.*)', '\1') msgBox(64, $s_Host, $s_Page) but i found some problems i need your help to correct it first: when i get the host if the url has www i want to remove it second: if the url with out host did not have other things i need the result to be "" e.g https://www.example.com the first i want it example.com and the second i want it to be "" i hope that you can help me thanks in advance
- 15 replies
-
- stringregexpreplace
- replace
-
(and 2 more)
Tagged with:
-
I have a text file whose data will be as below. win10x64 ~\erwin Notallowed1! "erwin Data Modeler r9.7 (32-bit)_2500.exe" SilentInstall.exe win10x64clone1 ~\erwin Notallowed1! "erwin Data Modeler r9.7 (64-bit)_2500.exe" DM64.exe win10x64clone2 ~\erwin Notallowed1! "erwin Mart Server r9.7 (32-bit).exe" SilentInstall.exe win10x64clone3 ~\erwin Notallowed1! "erwin License Server r9.7 (32-bit).exe" SilentInstall.exe Each line will have multiple values separated by space. If a value contains space in it, the value is surrounded by quotes. My task is to check how many values are there in each line. If the line contains 5 values, I need to replace the 4th value with the string contained in a variable. If it contains 4 values then also I need to replace the 4th value followed by appending 5 th value to it as SilentInstall.exe If the value I am replacing contains spaces then I need to surround the new value with quotes. Any one can suggest how to do this,??
-
_ArraySlice() its similar to list[n:n] in Python. I was converting a python script to autoit and was bored afterwords so I decided to create this UDF. #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 ; #FUNCTION# ==================================================================================================================== ; Name...........: _ArraySlice ; Description ...: Returns the specified elements as a zero based array. ; Syntax.........: _ArraySlice(Const ByRef $avArray[, $iStart = 0[, $iEnd = 0[, $iStep = 1]]]) ; Parameters ....: $avArray - Array to Slice ; $iStart - [optional] Index of array to start slicing ; $iEnd - [optional] Index of array to stop slicing ; $iStep - [optional] Increment can be negative ; Return values .: Success - Array containing the specified portion or slices of the original. ; Failure - "", sets @error: ; |1 - $avArray is not an array ; |2 - $iStart is greater than $iEnd when increment is positive ; |3 - $avArray is not an 1 dimensional array ; |4 - $iStep is greater than the array ; Author ........: Decipher ; Modified.......: ; Remarks .......: ; Related .......: StringSplit, _ArrayToClip, _ArrayToString ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== #include <Array.au3> ; Needed for _ArrayDisplay only. Example() Func Example() Local $MyArray[10] $MyArray[0] = 9 $MyArray[1] = "One" $MyArray[2] = "Two" $MyArray[3] = "Three" $MyArray[4] = "Four" $MyArray[5] = "Five" $MyArray[6] = "Six" $MyArray[7] = "Seven" $MyArray[8] = "Eight" $MyArray[9] = "Nine" Local $MyNewArray = _ArraySlice($MyArray, 9, 0, -2) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 5) _ArrayDisplay($MyNewArray) $MyNewArray = _ArraySlice($MyArray, 1, 3, 1) _ArrayDisplay($MyNewArray) EndFunc ;==>Example Func _ArraySlice(Const ByRef $avArray, $iStart = 0, $iEnd = 0, $iStep = 1) If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(3, 0, "") Local $iNew = 0, $iUBound = UBound($avArray) - 1 ; Bounds checking If $iStep > $iUBound Then Return SetError(4, 0, "") If $iEnd < 0 Or $iEnd > $iUBound Or $iEnd <= 0 And $iStep > 0 Then $iEnd = $iUBound If $iStart < 0 Then $iStart = 0 If $iStart > $iEnd And $iStep >= 1 Then Return SetError(2, 0, "") Local $aNewArray[$iUBound] For $i = $iStart To $iEnd Step $iStep ; Create a new zero based array $aNewArray[$iNew] = $avArray[$i] $iNew +=1 Next ReDim $aNewArray[$iNew] Return $aNewArray EndFunc ;==>_ArraySlice_ArraySlice.au3
-
How To split string into Array of char ?
-
I have a string like this: "Video or movie" "parent" "Media or entertainment" "1" "1" "1" "0" "0" I would like to split it by the spaces but the space inside the quote(both double and single quotes) should be ignored. So the splitted strings should be: "Video or movie" "parent" "Media or entertainment" "1"
-
I have a string looking like this: Outsider:myemail@myemail.com:26e0112200304f6d7598f6bd90a8478d:_KPQX)B7C0IX~!QgqG*V*){X<71O{{ This is how my database looks, I would like to split my file in to User Email Hash:Salt The reason why I wish to do this is to have an easier view of my users, I may also want to encrypt passwords even further and I cannot do this with a string looking like that! Thanks in advance.
-
Version 1.0.0.7
864 downloads
ImageSplitter split an image into pieces that can be used • for collage art. • for website optimisation (speed up the preview of images) • for printing purposes (big poster) • for create a puzzle. Load an image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose a format and select Columns and Rows count you want. Once Split Image processing is finished a folder with all splitted image parts will be opened. Parts of image are from left to right and from top to bottom. executable : -
Puzzle Game v1.0.1.4 Just for Fun, a tiny Puzzle game using >ImageSplitter functions ! Load any image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose the Pieces number you want. No sliding piece, just move Puzzle pieces where you want by drag&drop as a real puzzle. Sounds indicate if well or misplaced. Buttons were made online with chimply.com the easy and free buttons generator ! Compatible with AutoIt 3.3.8.1, 3.3.10.2 and Beta 3.3.11.4 Versions. Previous downloads : 67 Downloads available in the download section Have fun !
-
ImageSplitter v1.0.0.7 ImageSplitter split an image into pieces that can be used - for collage art. - for website optimisation (speed up the preview of images) - for printing purposes (big poster) - for create a puzzle. Load an image by menu or by drag&drop (jpg, gif, png and bmp are supported) Choose a format and select Columns and Rows numbers you want. Once Split Image processing is finished a folder with all splitted image parts will be opened. Parts of image are from left to right and from top to bottom. Button was made online with chimply.com the easy and free buttons generator ! ChangeLog version 1.0.0.7 : DPI Resolution can be preserved as original or changed. Multi files Split is now possible ( Only by Menu - Open - Multi files Split) previous downloads : 189 ImageSplitter v1.0.0.7.au3 is available in the Download Section Hope you like it !
-
#include-once ; #UDF# ======================================================================================================================= ; Title .........: PathSplitEx ; AutoIt Version : 3.3.8.1 ; Language ......: English ; Description ...: Splits a path into the drive, directory, file name and file extension parts ; Author(s) .....: DXRW4E ; Notes .........: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _PathSplitEx ; _PathSplitParentDir ; _FileExistsEx ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _PathSplitEx ; Description ...: Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing. ; Syntax.........: _PathSplitEx($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sFileName, ByRef $sExtension) ; Parameters ....: $sFilePath - The path to be split (Can contain a UNC server or drive letter) ; $sDrive - String to hold the drive ; $sDir - String to hold the directory ; $sFileName - String to hold the file name ; $sExtension - String to hold the file extension ; Return values .: Success - Returns an array with 5 elements where 0 = original path 1 = drive, 2 = directory, 3 = filename, 4 = extension ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: This function does not take a command line string. It works on paths, not paths with arguments. ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _PathSplitEx($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sFileName, ByRef $sExtension) $sFilePath = StringRegExp($sFilePath, "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\])?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = $sFilePath[1] $sDir = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sFileName = $sFilePath[3] $sExtension = $sFilePath[4] Return $sFilePath EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _PathSplitParentDir ; Description ...: Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing. ; Syntax.........: _PathSplit($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sParentDir, ByRef $sFileName, ByRef $sExtension) ; Parameters ....: $sFilePath - The path to be split (Can contain a UNC server or drive letter) ; $sDrive - String to hold the drive ; $sDir - String to hold the directory ; $sParentDir - String to hold the parent directory ; $sFileName - String to hold the file name ; $sExtension - String to hold the file extension ; Return values .: Success - Returns an array with 6 elements where 0 = original path 1 = drive, 2 = directory, 3 = parentdir, 4 = filename, 5 = extension ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: This function does not take a command line string. It works on paths, not paths with arguments. ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _PathSplitParentDir($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sParentDir, ByRef $sFileName, ByRef $sExtension) $sFilePath = StringRegExp($sFilePath & " ", "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*?[\/\\]+)?([^\/\\]*[\/\\])?[\/\\]*((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = $sFilePath[1] $sFilePath[2] = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sDir = $sFilePath[2] $sParentDir = $sFilePath[3] $sFileName = $sFilePath[4] $sExtension = $sFilePath[5] Return $sFilePath EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileExistsEx ; Description ...: Get New Files Name ; Syntax.........: _FileExistsEx(ByRef $sFilePath[, $iFileExists]) ; Parameters ....: $sFilePath - The Fullpath file ; $iFileExists - Optional ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _FileExistsEx(ByRef $sFilePath, $iFileExists = 0) While FileExists($sFilePath) $iFileExists += 1 $sFilePath = StringRegExpReplace($sFilePath & " ", "( - \(\d+\))?(\.[^\.\\]*)?(\h)$", " - (" & $iFileExists & ")$2") WEnd EndFunc _PathSplitEx.au3
- 43 replies
-
- _PathSplitEx
- File
- (and 8 more)