Find something by using an alphabet of it

Started by Xmair, Aug 13, 2017, 12:39 PM

Previous topic - Next topic

Xmair

As the topic states, I'm searching for a function like FindPlayer, if a player's name is "Xmair" you just use "ma" and it'd find the instance. Help is appreciated.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

.

#1
In my plugin there would be string masks. Like:
SqFind.Player.NameMatches(false, false, "*ma*");
Where it would search anything that contains `ma`. The `*` simply specifies: "I don't care what comes before it or after it." While `?` would take the place of any character. The first boolean would negate the result such that it finds someone where the name doesn't contain `ma`. And the second boolean controls case sensitivity.

But that would be in my plugin. In the official plugin, I have no idea what builtin method you would use because I'm not aware of one. Probably you'll have to do it manually through some regex.
.

EK.IceFlake

#2
FindPlayer("ma"); finds Xmair
:edit: If you just want to check if a string contains something:
local string = "TestingString";
if (string.find("ngSt") != null) print("This gets printed");
else if (string.find("ma") != null) print("This doesn't get printed");

Xmair


Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD