String building

Hello All,

I need help with string building where the length of the output string should be 8 and must contain

  • Upper and lower case
  • Numerical value
  • Special character

Thanks in advance

Hi @kaurM

Check out this activity where you can generate random strings by specifying the length & the case.

Hope this helps,
Best Regards.

Hey Thanks for your response! This generates string with just the alphabets, doesn’t include numbers and special chars

That kind of randomization is not suitable for generating passwords. It’s not truly random, and anyone who knows the algorithm can then break the password.

@kaurM

Well in that case, have a string variable for constant string value 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!?₹&@)(;:/-“‘.,

Create an array variable and assign this to it new string(Enumerable.Repeat(chars, length) .Select(s => s[random.Next(s.Length)]).ToArray());

The catch here is, if you generate a string of length 8 using this expression, there’s a slightest chance that you might not meet a specific condition, like what if it doesn’t indicate a special character!?
To tackel this, you can generate a length 4 string & other 4 charaters can be placed with accordance to the conditions, so that everything in stays on the same page.

(First set of 4 strings comes from the constant string mentioned above & you can derive the second set of random string by another constant string, let’s say - ‘Aa5$’
The second string set can be aranged in 24 variations but the first string set alone brings 77^4 possible combinations to the table. Thus 3,51,53,065 possible random strings in total)

Hope this is helpful & clear. Please let me know if this works.
Best Regards.

Thanks for the input @postwick. Although I’m not sure how many people might’ve cracked the randomisation algorithm here, it concerns me as you mentioned.

Best Regards.

Hi @kaurM

Check this custom activity.
https://marketplace.uipath.com/listings/generate-random-password

Hope this is helpful.

Your solution gave me a fair idea on how to proceed, Thanks for your time and effort :slight_smile:

1 Like

Thanks for your input. Unfortunately, my company doesn’t provide support on packages available on marketplace.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.