how to find index of int in a string? exceptions?
Shaun
shogan at iel.ie
Tue May 23 09:39:39 EDT 2000
ok,
i have variables ,id ,subId, nvSeqStr
a message will be passed in like...(some code & pseudo code below)
forgive me im still a newbie and i cant grasp this stuff at all....
class message:
import string
def __init__(self, id, subId, nvSequence):
self.id=id
self.subId=subId
self.nvSequence=nvSequence()
#overloaded constructor 1
#sets up member vars id and subId subId of type int
def __init__(self, id, subId, nvSequence=None):
self.id = id
self.subId = subId
self.nvSequence = nvSequence
def Message(StringMsg):
# what i want to do is,
1) find the index of the first integer in the string StringMsg
2) #on an error throw a format exception
3) save int in var id
4) find the index of the second integer in the string StringMsg
#on an error throw a format exception
save int in var subId
5) keep the rest of the string in var nvSeqStr
6) if nvSeqStr is not empty
7) try
decode it
#on an error throw a format exception
8) else
set nvSeqStr to null
#on an error throw a format exception
=====================
Shaun Hogan
Interactive Enterprise Ltd.
alt. E-mail : shaun_hogan at yahoo.com
Phone: +353 86 8342529
The University of Limerick Rollerhockey Club
URL: http://rollerhockey.csn.ul.ie
More information about the Python-list
mailing list