need help
COUNT occurrences
i need help i am makeing an program that will genrate an username form the fist and second name of the user useing the fist initial and the second name is there any code that i can use to count the varble ??
[235 byte] By [
zero80472] at [2007-11-11 8:01:00]

# 1 Re: need help
you can try generating the username by getting the first name and second name and then processing it character by character?
# 2 Re: need help
but i need to know how to porcess each charter (sorry for my spelling )
# 3 Re: need help
Use VB's Left function to return the first character, and the Split function to split the username into first and last names.
# 4 Re: need help
Hi.
ther are shorter methods, but this one is more obvious.
Supose..
txName= "Clark Nilo"
dim txFirst, txSecond, txResult as string
dim 2onPointer as integer
2ondPointer=instr(txName,chr(32))' if separator is different, change chr(32) to chr(..)
txResult=left(txName,1) & right(txName,2ondPointer+1,len(txName)-2ondPointer)
>>>>>Result>>> "CNILO"
# 5 Re: need help
Or, to use the methods Phil suggested...
Dim txName as string
dim sSplit() as string
dim sUserID as string
txName = "Phil Weber"
sSplit = split(txname, " ")
sUserID = left$(ssplit(0)) & ssplit(1)
'sUserID now contains "PWeber"
BW, MascalLineas, you have a couple of variants in your code.
dim txFirst, txSecond, txResult as string
returns txFirst and txSecond as a variant, and txResult as a string.
If you want all three to be strings, you need to do this:
dim txFirst as string, txSecond as string, txResult as string
# 6 Re: need help
Hi Edburdo.
I have "one line method" working only with the initial string, but..
I'v tryed to explain it, "line by line" , and "variable to variable" with simple methods.
Thanks.
# 7 Re: need help
No problem... I could write up a one liner too... but it's easier to explain (as you pointed out) in pieces.
I was just making you aware of the fact that declaring multiple variables on one line requires you to type EACH VARIABLE, or they end up as variants (and variants are evil :) )
# 8 Re: need help
Hy Edburdo. Ok.
I have only one doubt about it.
Has it been usefull for Zero80472?
I do'nt know.
In my country, No news..Good news! but...
Till soon.