← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #223404]: need to change the case of some text

 

Question #223404 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/223404

    Status: Open => Answered

RaiMan proposed the following answer:
these are the basics you need:

name = "John Doe" # read from file
(first, last) = name.split(" ")
first = first.strip() # get rid of whitespace
last = last.strip()

userids = [] # the possible variants
userids.append(first+last) # full
userids.append(first[0]+last) # first-short + last

userid = "jdoe02" # read from file
newuid = None

for uid in userids:
    if userid.startswith(uid.lower()):
        newuid = uid + userid[len(uid):]

if newid: print "converted", userid, newuid
else: print "could not convert", userid

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.