incrementing the login name by 1

I need to create unique users. My thought is to create a first user, say: test1 and veryfy with my application that it is a unique one. When creating the second user, I will use test1 again and I should get the message from my application, that the user alredy exists. At this point I would like to increment the last character of the user's name making it test2, etc. Can someone help me?

Thanks,

Hanna

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    I think you'd just want to build the username string to start with a string plus a variable containing a number and then increment that number as necessary:
    put 1 into usernum
    put "test" & usernum into username
    //do your verification
    if <username>
         add 1 to usernum
         put "test" & usernum into username
    end if
    

    If you put this in a repeat loop, you could use the repeatIndex() function as your counter:
    repeat 20 times
         put "test" & repeatIndex() into username
         //do your verification
    end repeat
    
Sign In or Register to comment.