![]() |
|
[.NET] [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] [VB.NET] Find and match string using last 2 characters from input [NUB Question] (/showthread.php?tid=6054249) |
[VB.NET] Find and match string using last 2 characters from input [NUB Question] - Cendrix - Mar 3, 2020 I have two RichTextBoxes, 1 and 2. RichTextBox1.Text contains a CD Key, example: SP-GSsdv-xdHXx-BSjFx RichTextBox2.Text contains a list of CD KEYS, as follows: SP-pazeF-wAQLv-D7f1T SP-26KXJ-2zHF0-FXa2h SP-HcZbE-3LriX-pvwbH SP-pcp4L-o4NaW-7lTWk SP-fnNGt-T5zoq-dJBqT SP-EJJRu-5Gz2X-VRAUY SP-ROkHN-iCELi-TZXdh SP-Np4lf-vlrdl-k8sFx - Target key, it is similar ending in Fx (Case Sensitive), but different from the first SP-7Asff-8785S-SFEig SP-CbnRy-mTZQA-sykzp I'm trying make it so when I click a button, it takes the last 2 characters from the Key in RTBox1 ("Fx" in this case), then it automatically finds/matches a similar CD key ending in the exact same 2 characters from RTBox2 (Case Sensitive) Basically, it must be case sensitive and keep it's upper or lower / combined characters exactly how it's given in RTBox1. If it was fX, fx, FX, then it should keep it's case sensitive and find a similar looking one from RTBox2. Then Msgbox with the resulted / similar looking Key that picked from RichTextBox2 (SP-Np4lf-vlrdl-k8sFx = final result in this case) Can anyone help me out please? I'm still new to VB.net and learning and I don't how to deal with matching strings / situations yet Thanks in advance RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - 4Txe4y33C9zvNhMj - Mar 3, 2020 I have no clue about VB.NET, did some googling so I can post you some snippets at least: This should work for getting the last two characters of your string Code Dim result As String = result = str.Substring(str.Length - 2)Now you can just compare that result string to your first key's last 2 characters (use the same method to get the two last characters of that key) You can just get the full text from your second textbox and split it into an array (or a vector or whatever you guys have in VB) with the newline character as a delimiter. After that just repeat the above steps RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Cendrix - Mar 4, 2020 I still can't figure it out :\ It might be super easy but I just cannot find anything helpful on Google and so on Can any experienced VB.NET coder please provide me a full code 0-100 for exactly what I'm looking for in OP ? It is simply too much for me at the moment :| Will pay $5 BTC as a thank you, so I can learn from it. RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Ajumma - Mar 4, 2020 (Mar 4, 2020 08:12 AM)Cendrix Wrote: I still can't figure it out :\ ![]() Code Dim searchFor As String = RichTextBox1.Text.Substring(RichTextBox1.Text.Length - 2)Should be good enough for you to finish the rest or whatever else RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Cendrix - Mar 4, 2020 (Mar 4, 2020 08:36 AM)Ajumma Wrote: Now it looks super easy. Kindly PM me your BTC address or post it here if you want ✌ Thanks a bunch. RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Ajumma - Mar 4, 2020 (Mar 4, 2020 08:52 AM)Cendrix Wrote: Now it looks super easy. 3QrzesdCSnJoYNEoSxXLG7ZrigF3EKfz7d RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Cendrix - Mar 4, 2020 (Mar 4, 2020 09:18 AM)Ajumma Wrote: 3QrzesdCSnJoYNEoSxXLG7ZrigF3EKfz7d Sent 👍 RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - yeio - Mar 21, 2020 if you haven't solved it, I'll do it for you RE: [VB.NET] Find and match string using last 2 characters from input [NUB Question] - Cendrix - Mar 21, 2020 (Mar 21, 2020 02:07 AM)yeio Wrote: if you haven't solved it, I'll do it for you I've solved it, thx anyway Closing this |