News A server update was released on July 20. Server patch notes and downloads are here. Additionally, a client update was released on the same day. Client patch notes are here.
This topic was marked solved by its starter, on August 13th, 06:12 PM
Find something by using an alphabet of it

Xmair

  • Wiki Contributor
  • Posts: 741
Find something by using an alphabet of it
«  »
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.
I convert minecraft worlds to VCMP, if you want your worlds to be converted, shoot me a PM! (Please note the paintings, flower pots, armour stands and custom skulls won't be converted within the model. Also big objects won't be converted)

.

  • Hero Member
  • Posts: 1,784
Re: Find something by using an alphabet of it
« Reply #1,  »Last edited
In my plugin there would be string masks. Like:
Code: [Select]
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

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,727
Re: Find something by using an alphabet of it
« Reply #2,  »Last edited
FindPlayer("ma"); finds Xmair
:edit: If you just want to check if a string contains something:
Code: [Select]
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

  • Wiki Contributor
  • Posts: 741
I convert minecraft worlds to VCMP, if you want your worlds to be converted, shoot me a PM! (Please note the paintings, flower pots, armour stands and custom skulls won't be converted within the model. Also big objects won't be converted)