Re: irc chat.....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Yves Dhondt (no_at_privacy.net)
Date: 07/18/04


Date: Sun, 18 Jul 2004 18:09:58 +0200

Supra wrote:

> How do i parse the first nick before exclamation only. i am working
> on irc chat similar to PIRCH or MIRC. I can only do this in vb6
> here is debug.writeline:

What do you mean by that? That you know how to do it in VB6 but not in
VB.Net or that you're looking for a VB6 answer? In the latter case,
you're in the wrong group.

For VB6 I suggest you check out the Mid function.

For .Net there are a couple of ways of doing this, the most clean one
would be to use regular expressions :
Regex("([\\w\\-\\[\\]\\`_\\^\\{\\|\\}]+![\\~\\w]+@[\\w\\.\\-]+)",
RegexOptions.Compiled | RegexOptions.Singleline);

But considering the 'slowness' of regex in the framework atm and the
amount of privmsg you will receive on busy channels, i think you're
better of using simple string manipulations like you did.

>
> Picota!lol@96.Red-213-97-140.pooles.rima-tde.net PRIVMSG #india :any1
> seen a-kash?
>
> eLif^^`!~ltowhd@81.213.252.106 JOIN #india
>
> Dim str As String = "Picota!lol@96.Red-213-97-140.pooles.rima-tde.net
> PRIVMSG #india :any1 seen a-kash?"
> Dim intI As Integer = str.IndexOf("!")

Next I would check if you have a result, things like PRIVMSG in irc can
be send from a server directly (though highly unlikely). If they are
send from a server there will be no "!" in them. So you will have no
real nick. So you should check that intI > -1

> str = str.Substring(intI - 6)

Here you would need to use the overloaded version of the Substring
functionality

Dim nick As String = str.Substring(0, intI)

> TextBox1.AppendText(str)
>
> i can't get nick name. i need first nick Picota , etc.
>

Yves