hello there is a code. I loop through the child pictures of the grid. In pictures, the name of the type is "Q1_2"; Numbers can be from 0 to 14. So I create 2 random numbers from 0 to 14 and I want to check if the number in the name before the _ sign corresponds to Row and the last number in the name after the _ sign corresponds to Column then do some actions.
int Row = random.Next(0, 14); int Column = random.Next(0,14); foreach (var child in chidrens) { i = child as Image; if (i is Image) { //ΠΠΎΡ ΡΡΡ ΠΏΠΎΠ»ΡΡΠΈΡΡ ΡΠΈΡΠ»Π° ΠΈΠ· ΠΈΠΌΠ΅Π½ΠΈ ΠΈ ΡΡΠ°Π²Π½ΠΈΡΡ Ρ ΡΠ°Π½Π΄ΠΎΠΌΠ½ΡΠΌΠΈ ΡΠΈΡΠ»Π°ΠΌΠΈ } else { //ΠΈΠ½Π°ΡΠ΅ } } I think to do so
Regex regex = new Regex(@"\d{2}_\d{2}"; but I understand it will look for 2 digits I have and one digit is what to do
Regex regex = new Regex(@"\d{1}_\d{1}"; Tell me how to do it in a normal way.
001002Then it will be possible to read the first and last 3 digits from the line - your numbers. - codename0082016obj_Q1_2.name obj_Q1_2_.n1 obj_Q1_2_.n2and take your data from it - codename0082016Namecontrols also have such a property asTag, you can write in it the numbers of pictures you need, without any initial letters and other unnecessary garbage. You can make a through numbering of pictures or make a numbering from a two-digit number - for the row and column numbers. - Bulson