Heya!
I was kind-of bored in the last 30 minutes, and I asked myself a long time ago: Is it possible to make a Percentage calculator for strings? Is it possible, to compare two strings and get a percentage?
Answer: Yes! I kinda figured it out today, it’s not that hard.
And so I did. Introducing: String Percentage Calculator!!
And before anything, yes I know you could make this very fast by just writing one of your own, but it would take some time. So, I made a module script which you can require from every script to calculate the equality of two strings in a percentage form.
How to get started
First off, you would need to require the following ID: 11095284024
. This ID leads to the asset I made,
Click here to view.
You can require this by doing the following:
local variable_name = require(11095284024)
How to use it
So, basically, what you need are two strings! One is the string that the other is compared too, which is the first argument of the function I am going to show you. The second one can be any input, if you want.
Let me show you!
local string_compare = require(11095284024)
print(string_compare.calculate(
"Hey!!!", --[[This is the string that the second argument is being compared to!]]
"Hey!!" --[[This is the string that is being compared to the first argument!]]
))
The outcome of this would be: 83
(% but It’s returning an integer for easier use!)
And that’s basically it, feel free to use this without credit, I don’t need it.
You can suggest updates in the comments!
Many thanks,
quezSypher!