jvanegmond Posted June 27, 2007 Posted June 27, 2007 StringTrimLeft and StringRight do exactly the same. Don't you think we could lose either of the two functions? The same counts for StringTrimRight and StringLeft, and I am sure more of these functions can be found in AutoIt.I believe that removing unnecessary functions, the file size of AutoIt could be reduced. We may be talking bytes here, but in the end it may also count up to a few kilobytes.Is there anyone that may want to shed light on this subject? github.com/jvanegmond
Moderators SmOke_N Posted June 27, 2007 Moderators Posted June 27, 2007 Manadar said: StringTrimLeft and StringRight do exactly the same. Don't you think we could lose either of the two functions? The same counts for StringTrimRight and StringLeft, and I am sure more of these functions can be found in AutoIt.I believe that removing unnecessary functions, the file size of AutoIt could be reduced. We may be talking bytes here, but in the end it may also count up to a few kilobytes.Is there anyone that may want to shed light on this subject?What happens when you know exactly how many chars to the left or right you want to go, but not the opposite? Then you have to get into StringLen() - or + X blah blah.... 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.
SkinnyWhiteGuy Posted June 27, 2007 Posted June 27, 2007 As far as this is concerned, using solely StringMid and StringLen, I could replace all 4 with UDFs: Func _StringLeft($sString, $iNum) If $iNum <= 0 Or Not IsInt($iNum) Then Return SetError(1, 0, 0) If Not IsString($sString) Then Return SetError(2, 0, 0) Return StringMid($sString, 1, $iNum) EndFunc Func _StringRight($sString, $iNum) If $iNum <= 0 Or Not IsInt($iNum) Then Return SetError(1, 0, 0) If Not IsString($sString) Then Return SetError(2, 0, 0) Return StringMid($sString, StringLen($sString) - $iNum + 1, StringLen($sString) - $iNum) EndFunc Func _StringTrimLeft($sString, $iNum) If $iNum <= 0 Or Not IsInt($iNum) Then Return SetError(1, 0, 0) If Not IsString($sString) Then Return SetError(2, 0, 0) Return StringMid($sString, $iNum + 1, StringLen($sString) - $iNum) EndFunc Func _StringTrimRight($sString, $iNum) If $iNum <= 0 Or Not IsInt($iNum) Then Return SetError(1, 0, 0) If Not IsString($sString) Then Return SetError(2, 0, 0) Return StringMid($sString, 1, StringLen($sString) - $iNum) EndFunc Same can be done with the new binary type and their appropriate functions. Only thing with removing these functions, it'd break so many scripts, it might not be worth it.
RazerM Posted June 27, 2007 Posted June 27, 2007 (edited) I think StringTrim* functions should be replaced with UDF's. Func _StringTrimLeft($sStr, $iCount) Return StringRight($sStr, StringLen($sStr)-$iCount) EndFunc Edited June 27, 2007 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Lazycat Posted June 27, 2007 Posted June 27, 2007 Backprocess is coming? Well, let's remove all other functions, leave only DllCall and redone all functions as UDF's Seriously, removing Trim* functions will save 100-200 bytes of size and give you headache with compatibility and speed issues. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
RazerM Posted June 27, 2007 Posted June 27, 2007 I suppose it's one of the should have been made earlier (if developers agreed) choices. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Developers Jos Posted June 27, 2007 Developers Posted June 27, 2007 (edited) I am lost on this discussion ... They are there and serve a purpose ... full stop . Edited July 5, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
MHz Posted June 28, 2007 Posted June 28, 2007 Manadar said: StringTrimLeft and StringRight do exactly the same.You are absolutely incorrect!Debate over.
McGod Posted July 5, 2007 Posted July 5, 2007 You remove them, you will break scripts so might as well leave em be. [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
Developers Jos Posted July 5, 2007 Developers Posted July 5, 2007 Chip said: You remove them, you will break scripts so might as well leave em be.Think the discussion was closed and conclusion drawn that they are not one and the same ...... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts