Isn't it easier to use the built function StringMin, especially when its the code does exactly the same thing?
USER>w $length(##class(%PopulateUtils).StringMin(100,100)) 100
Source code:
ClassMethod StringMin(
minlen As %Integer = 1,
maxlen As %Integer = 1) As %String [ ProcedureBlock = 1 ]
{
if maxlen '< minlen {
set len=$$$PRand(maxlen-minlen+1)+minlen,
string=""
for i=1:1:len {
Set charn=$s($$$PRand(2):$$$PRand(26)+65,1:$$$PRand(26)+97),
string=string_$s(charn<123:$c(charn),1:" ")
}
quit string
} else { quit "" }
}- Log in to post comments
