New topic: 

How to get strings from editfield

<http://forums.realsoftware.com/viewtopic.php?t=25894>

       Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic         Author  
Message       digitalexpl0it           Post subject: How to get strings from 
editfieldPosted: Mon Jan 05, 2009 11:50 pm                        
Joined: Mon Jul 24, 2006 11:36 am
Posts: 15              Hello,
I am creating a chat client for a friends chat server, but I am having some 
trouble grabbing the user names and removing them from the main editfield then 
placing them into a list box. I need them to be placed in the list box by the 
users number and name. EX: [0]Derrick, [1]Testname. I would like to have two 
columns in the list box where the number is first then there name, so for 
[0]Derrick it will be 0 Derrick. Below is an example output from the chat using 
TCPSocket. Every time you log into the chat the users names are shown with a + 
in front of the names. When someone changes there name or quits the chat a - is 
shown before the name.

Example Output:
=================================================
>> You just logged on line 0 from: localhost
>> Your name is now: NakenUser
[0]NakenUser connected using LittleBear +[0]NakenUser
[0]NakenUser: this is a test
>> Someone just logged on line 1 from: localhost
+[1]localhost
-[1]localhost
+[1]Derrick
-[0]NakenUser
>> Your name is now: Digitalexpl0it
+[0]Digitalexpl0it
=================================================

I have created a bot in PHP that grabs the user names and puts them into an 
array like this:
Code:
//Split Buffer for commands
$get = explode(": ",$output);
$get_command = $get[1];

// build userlist array
if(preg_match('/^[+-]\[([0-9]+)\](.*)$/', $output, $matches)) {
if($output[0] == '+') {
$names[$matches[1]] = trim("[".$matches[1]."]".$matches[2]);
} else {
unset($names[$matches[1]]);
}
}
$userlist_separated = @implode(", ", $names);


Is there a way I can do this?

Right now I have this, but it only adds one name to the list box and doesn't 
split up the number and name:
Code:
if window2.chatter.Text <> "" Then
  Dim parts() As String
  Dim many,i As Integer
  
  parts = Split( window2.chatter.Text, "+" )
  many = Ubound(parts)
  
  For i = 1 to many step 2
  window2.userlist.Cell(window2.userlist.LastIndex,1)= ReplaceAll(parts(i), 
"""", "") //second column
  Next
End If



any help would be great, I am stuck.

Thank you   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]     

-- 
Over 900 classes with 18000 functions in one REALbasic plug-in. 
The Monkeybread Software Realbasic Plugin v8.1. 

&lt;http://www.monkeybreadsoftware.de/realbasic/plugins.shtml&gt;

[email protected]

Reply via email to