Author Topic: seperating strings of messages  (Read 4248 times)

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
seperating strings of messages
« on: October 15, 2006, 06:58:27 PM »
okay, Im trying to seperate a message into parts. I tryed using mid but it doesnt work since i have to specify where to stop. Basically, Is there a way to sepereate a string, starting wherever a # is placed.

so like if string = " testing123 # Hello"
then string1 = "testing123 "
and string2 = "# hello"
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: seperating strings of messages
« Reply #1 on: October 15, 2006, 07:51:51 PM »
You need to use INSTR to find the # character.
Code: [Select]
i = instr(strVal,"#")
if i > 0 then
 strVal1 = left(strVal, i-1)
 strVal2 = mid(strVal, i)
end if
Something like this, in any case.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: seperating strings of messages
« Reply #2 on: October 15, 2006, 08:32:14 PM »
okay, what am i doing wrong?

Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)

messagevar = lcase(Message)
i = instr(messagevar,"#")
if i > 0 then
 string1 = left(messagevar, i-1)
 string2 = mid(messagevar, i)
 temp1 = left(Message,string1)
 SendCommand "/msg " & Channel & " " & string1 & "", ServerNumber
end if
SendCommand "/msg " & Channel & " " & i & ", " & string1 & "", ServerNumber

End Sub
This message brought to you by the Wonderful Wizard of Oz.