﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2841	_StringRepeat adds string once even if parsed count is zero	RTFC	Melba23	"Hi devs!
RTFC here. I use _StringRepeat with a variable count in file I/O for struct padding. This count can be zero, but one instance is always added. Id' like a count of zero to mean: ""no padding.""

Example 
{{{
#include <String.au3>
MsgBox(0,""test"",StringLen(_StringRepeat("" "",0))) ; << should be zero!!!
}}}

Annotation in <String.au3> explicitly states zero is valid input, but a final instance of string is added outside of the catenation loop, as marked below in original UDF in String.au3 (penultimate line):


{{{
Func _StringRepeat$sString, $iRepeatCount)
	; Casting Int() takes care of String/Int, Numbers.
	$iRepeatCount = Int($iRepeatCount)
	; Zero is a valid repeat integer.
	If StringLen($sString) < 1 Or $iRepeatCount < 0 Then Return SetError(1, 0, """")
	Local $sResult = """"
	While $iRepeatCount > 1
		If BitAND($iRepeatCount, 1) Then $sResult &= $sString
		$sString &= $sString
		$iRepeatCount = BitShift($iRepeatCount, 1)
	WEnd
	Return $sString & $sResult ; <<<<<< FAILS HERE <<<<
EndFunc   ;==>_StringRepeat

}}}

Thanks for looking at this,
RTFC"	Bug	closed	3.3.13.17	AutoIt	3.3.12.0	None	Fixed	stringrepeat	
