You can use array slicing on the string
$loginName = ($lastNameFiltered + “.” + $firstNameFiltered)[0..19] -join ''
That will produce the same result, but doesn’t fuss if the string is less than 20 characters.
You can use array slicing on the string
$loginName = ($lastNameFiltered + “.” + $firstNameFiltered)[0..19] -join ''
That will produce the same result, but doesn’t fuss if the string is less than 20 characters.