Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Visual Basic(deleting spaces, putting each line into textbox

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Butcher
Expert Cheater
Reputation: 0

Joined: 04 Mar 2009
Posts: 125
Location: lAS vEGAS no joke

PostPosted: Tue Oct 13, 2009 4:03 pm    Post subject: Visual Basic(deleting spaces, putting each line into textbox Reply with quote

OK, SO i have this program that outputs all the servers on a specific game. It outputs it to a text file. HOWEVER, There is a lot of annoying spaces. This is kind of hard to explain, so ill try to explain it. This is what The text file looks like.
Code:

 173.81.220.139   2302
   70.26.235.69   2302
  24.26.119.209   2302
   99.244.109.8   2302
190.234.169.198   27667
189.143.252.124   2302
189.148.109.184   2302
 220.106.200.28   53311
216.165.236.137   2302
   65.12.248.94   2302
  124.45.123.17   41441
189.143.252.124   50745
  84.30.139.238   2302
   76.30.11.219   2302
 200.106.34.224   10580
   201.211.7.78   2302
131.193.195.171   2302
   98.208.217.4   2301
 69.116.167.105   2302
  124.45.123.17   47337
  74.98.230.118   2302
   75.74.93.241   2302
 68.198.172.217   2302
   74.174.178.3   35094
  124.45.123.17   53434
  41.248.215.87   2302
  124.45.123.17   43333
 74.220.166.108   2302
 88.222.185.158   2302
   190.84.10.60   2302
    98.27.4.236   2302
    99.36.34.86   2302
  187.47.81.218   2302
 174.48.246.228   63983
 76.179.169.160   2302
   24.7.253.125   2302
  66.99.228.134   19437
  124.45.123.17   49339
166.127.145.158   2302
 190.159.82.229   60282
  24.86.137.206   2302
  89.229.49.196   2302
  70.226.226.99   2302
   88.8.209.149   2302
  201.211.12.56   2302
  68.190.45.152   2302
189.132.198.166   2302
 71.231.161.196   2302
 24.189.104.244   2302
   70.241.67.29   2302
  68.36.154.208   2302
  174.101.179.3   2302
    24.57.37.32   2302
190.144.118.179   2302
  190.153.1.108   2302
   24.78.47.171   2302
 77.160.226.145   53091
  76.185.255.23   2302
  60.240.173.36   64216
123.211.165.239   49170
    68.73.53.72   2302
  99.233.147.22   2302
   208.66.39.40   2302
   98.196.13.20   2302
 174.48.100.105   2302
  124.45.123.17   42442
   72.65.40.160   50872
 189.142.61.152   2302
 76.252.224.218   2302
 187.137.44.195   49274
  84.84.189.182   22780
189.188.190.168   2302
 99.227.120.207   2302
   75.185.82.50   60002
    24.37.84.17   2767
    76.101.8.37   2302
   65.3.161.164   33321
  71.115.153.77   50994
  60.240.173.36   61200
   82.47.74.249   5402
201.245.252.111   2302
   88.76.115.72   2302
189.194.103.233   2302
  70.79.160.135   2302
  69.249.40.120   2302
  96.239.153.86   2302
 70.145.216.205   2302
 199.126.131.17   61083
  201.250.27.28   2302
 75.121.227.102   50028
  174.103.116.3   2302
 190.200.115.11   62415
  71.237.60.170   2302
   75.152.70.14   2302
 71.158.169.144   2302
   86.100.89.69   62175
    65.10.1.144   2302
 83.119.150.130   2302
    84.46.92.82   2302
  99.247.253.48   2302
     80.2.74.48   2302
  69.250.32.247   2302
  124.45.123.17   48338
 76.234.122.190   2302
   200.25.249.3   8046
  124.45.123.17   46446
    24.37.84.17   2302
 72.187.138.153   2302
   81.84.203.54   2302
   81.226.56.81   63351
 69.109.209.244   2302
   97.102.67.38   2302
 174.112.96.215   61175
    208.62.1.31   2302
 94.215.244.196   2302
    208.62.0.67   2302
  24.237.251.96   2304
   98.163.93.55   60130
  60.240.173.36   61204
  124.45.123.17   46336
 24.150.147.192   63887
   68.35.42.211   2302
 189.161.229.34   2302
 68.238.216.149   50497
   76.30.203.19   2302
189.130.116.249   2302
   96.228.9.136   50739
  68.221.214.58   50667
 189.228.126.78   2302
  82.36.136.230   2302
 99.140.244.228   2302
  67.213.103.78   2302
   69.224.34.92   2302
 189.58.209.233   15487
   190.84.8.120   2302
 190.65.182.134   23458
   4.129.84.200   2302
 98.202.138.233   2302
  68.102.138.12   2302
 89.156.129.218   61795
 98.203.117.231   2302
  74.170.16.140   2302
  124.45.123.17   44444
   67.197.4.222   2302
 189.130.91.130   2302
  124.45.123.17   42332
 24.237.254.232   2302
  189.143.92.40   2302
  85.48.166.166   2302
 186.28.209.109   10463
   24.23.83.220   2302
  24.237.251.96   2302
 70.156.239.236   50306
    92.29.33.19   10932
   190.40.60.65   27564
201.230.127.220   25728
 141.153.174.86   50434
   75.141.184.3   36570
  87.207.95.213   2302
  92.224.37.226   2302
 68.172.230.239   2307
189.176.229.224   2302
  99.245.43.105   63854
 190.20.119.135   19770
   96.20.221.74   2302
  89.229.239.88   2302
 68.193.183.147   2302
  124.45.123.17   45445
  65.191.97.253   2302
  74.61.227.158   2302
  85.247.158.70   55157
190.214.120.250   14505
  71.50.211.179   2302
 189.163.38.105   2302
   189.147.98.5   2302
 189.170.95.200   2302
  124.45.123.17   40440
   190.82.2.217   25311
  124.45.123.17   43443
  68.41.207.162   2302
 208.60.181.131   2302
   92.201.49.93   2302
  97.92.237.181   1507
  76.110.54.243   2302
  99.20.192.100   2302
  69.207.196.27   2302
  124.45.123.17   45335
   87.9.172.202   2302
  60.240.173.36   61202
  190.66.154.94   2302
 63.162.200.198   14374
  70.129.166.82   2302
   190.25.24.96   2302


As you can see, they have these annoying spaces. What I want to do:
1. Get rid of the spaces, BUT KEEP A SPACE BETWEEN THE IP AND THE PORT.
2. After the spaces that are bad are gone, I want the program to output each single IP AND port To its own text Box. It doesn't matter is the textbox of the IP and Port are seperated, It can just be one textbox with the IP and port, with a space between them. Thats about it!! I have the GUI done, and the rest of the programming, all I need now is this.
Reformat without spaces > output each seperate line of text to a seperate textbox > THX


PS, is there a way for VB to send a command to the command prompt? Say, I wanted it to open a CMD box and send ipconfig into that box, what would that be? THANKS SO MUCH GUYS!!

_________________
www.aowhacks.tk if you play Act of War, working online hacks there!!

LIke my pic?
Back to top
View user's profile Send private message
Geek4Ever
Master Cheater
Reputation: 1

Joined: 31 Oct 2008
Posts: 353
Location: Milano,Texas

PostPosted: Tue Oct 13, 2009 4:47 pm    Post subject: Reply with quote

Replace(StringToSearch, StringToFind, ReplaceString, Start, Count, Compare)
look more into that it should help u alot.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Oct 13, 2009 4:57 pm    Post subject: Reply with quote

Well you know there's only spaces to be removed before the IP's so delete every character until you reach one which isn't a space
Back to top
View user's profile Send private message MSN Messenger
Butcher
Expert Cheater
Reputation: 0

Joined: 04 Mar 2009
Posts: 125
Location: lAS vEGAS no joke

PostPosted: Tue Oct 13, 2009 5:07 pm    Post subject: Reply with quote

OK, I have found something. Now all I need to do is something to delete the FIRST space of each line of text, none of the other spaces, and im GOOD TO GO!!
_________________
www.aowhacks.tk if you play Act of War, working online hacks there!!

LIke my pic?
Back to top
View user's profile Send private message
iTz SWAT
I post too much
Reputation: 1

Joined: 20 Dec 2007
Posts: 2227
Location: Me.Location;

PostPosted: Tue Oct 13, 2009 5:52 pm    Post subject: Reply with quote

You got a reply...
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/9882ad31-9933-4d4b-be5f-240d734ff281

_________________
Back to top
View user's profile Send private message
Butcher
Expert Cheater
Reputation: 0

Joined: 04 Mar 2009
Posts: 125
Location: lAS vEGAS no joke

PostPosted: Wed Oct 14, 2009 12:57 pm    Post subject: Reply with quote

lol
_________________
www.aowhacks.tk if you play Act of War, working online hacks there!!

LIke my pic?
Back to top
View user's profile Send private message
Odecey
Master Cheater
Reputation: 1

Joined: 19 Apr 2007
Posts: 259
Location: Scandinavia

PostPosted: Wed Oct 14, 2009 1:45 pm    Post subject: Reply with quote

Butcher wrote:
OK, I have found something. Now all I need to do is something to delete the FIRST space of each line of text, none of the other spaces, and im GOOD TO GO!!

I'd suggest using Regular Expressions(This is a good place to start). That way, you can easily check the format of the info on each line aswell.
In C# it could look something like this:
Code:

// The code makes use of the System.Net,System.IO and System.Text.Regular Expressions namespaces
Dictionary<IpAddress, int> IPs = new Dictionary<IpAddress, int>();
using (TextReader fileReader = new StreamReader(filename))
{
string fileData = filereader.ReadToEnd();
IPAddress IPBuf = IPAddress.None;
int portBuf = 0;
Match matchBuf;
foreach(Match line in Regex.Matches(fileData,@"(?<=^)[ 0-9 \. \s]+(?=$)",RegexOptions.Multiline))
{
if((matchBuf=Regex.Match(line.Value,@"(\d{1,3}\.){3}\d{1,3}")) != Match.Empty)
{
IPBuf = IPAddress.Parse(matchBuf.Value);
if((matchBuf =Regex.Match(line.Value,@"(?<=\s+)\d+(?=\s*$)")) != Match.Empty)
{
portBuf = int.Parse(matchBuf.Value);
IPs.Add(IPBuf, portBuf);
}
}
}

_________________
Never confuse activity with productivity. You can be busy without a purpose, but what's the point?- Rick Warren
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites