jaenster Posted October 8, 2006 Posted October 8, 2006 $string = "Hello"&@crlf&"My name"&@crlf&"is"&@crlf&"jaenster" ; Create a string with 4 line's msgbox(0,"Get the line ",_getline($string,3));Get line number 3 of the string #cs=============================================================================== Function Name: _GetLine() Description: Get a line of a multie lined string Parameter(s): $read - The string from we get the line $c - Line number Requirement(s): AutoIT 3.* Return Value(s): On success Line $c On error -1 Error(s): @error = 1 : if you want a line that not exits Author(s): jan "jaenster" =============================================================================== #ce func _GetLine($read,$c) $read = stringsplit($read,@cr) for $i = 1 to $read[0] if asc(stringmid($read[$i],1)) = 10 then $read[$i] = stringmid($read[$i],stringlen($read[$i])-(stringlen($read[$i])-2)) endif next if $read[0] < $c then seterror(1) return -1 endif return $read[$c] endfunc Thanks for watching -jaenster
RazerM Posted October 8, 2006 Posted October 8, 2006 This can be done in 3 lines: Func _GetLineEx($sText, $iLine) $lines = StringSplit(StringStripCR($sText), @LF) If $iLine < $iLine Then Return SetError(1, 0, -1) Return $lines[$iLine] EndFunc ;==>_GetLineEx 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.
jvanegmond Posted October 8, 2006 Posted October 8, 2006 All this talking about lines makes me hungry. github.com/jvanegmond
this-is-me Posted October 8, 2006 Posted October 8, 2006 Shorter: Func _GetLine($sText, $iLine) $lines = StringSplit($sText, @CRLF, 1) If $lines[0] < $iLine Then Return SetError(1, 0, -1) Return $lines[$iLine] EndFunc Who else would I be?
RazerM Posted October 8, 2006 Posted October 8, 2006 @this-is-me that won't work if $sText is delimited by by only @LF. 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.
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