I am new to Unity and my requirement is to generate a random string based on regular expression in C#. My code is working well in Console Application, however, I am getting error for Fare namespace in UnityEditor. I explored on Internet and different forums, however, I didn't found any solution. Below is my code.
string GenerateString()
{
string pattern = "^x[a2]{9,15}";
var xeger = new Xeger(pattern);
string generatedString = xeger.Generate();
generatedString = xeger.Generate();
return generatedString;
}
The error I am getting in UnityEditor is as follows;
Assets\Scripts\PlayerController.cs(3,7): error CS0246: The type or namespace name 'Fare' could not be found (are you missing a using directive or an assembly reference?)
I have tried the solution provided here for Nuget packages and Unity errors. The solution provided here works fine for "Fare" namespace however, UnityEngine.UI starts problem and visual studio shows that this namespace is not installed. Furthermore, I have tried to install NugetForUnity it didn't work too.
My Requirement is: Generate random collectibles and each collectible should have a randomly generated string with length ranging from 9 to 15 characters using 3 alphabets. The first alphabet should be x. The second and third one should be derived from your first name and registration number – the first letter of the first name and last digit of your registration number. E.g. If my name is Abcd and my registration number is AB20-12786, then alphabets for my strings would be (x, a, 6).
Any other suggestion will be highly appreciated for string generation for the above requirement. Thanks in Advance.
Fare(or is that whereXegercomes from which I also don't know) ... could you show your complete code?using Fare;.. is this a library you imported into your project?