mudface061200
asked on
Strings and Arrays (easy 50 points)
I have a string that is something like "AAAA 9999" and all I'm interested in is the first 4 or 5 letters, I want to split at the whitespace. I know the split function returns an array. Isn't there a way to convert an array into a string in one line of code instead of a loop?
Note: I can't use Left() because the letters might be longer than 4 chars in some cases.
Thanks.
oops you can't leave out the delimiter to get a concatinated string
ex
s = join(array,"")
ex
s = join(array,"")
sNew = left(sString,instr(sString ," ")-1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jrspano,
Maybe I wasn't clear, all I want is the first sequence of letters, I don't want the numbers at all, and I surely don't want to concatenate them. So my desired result is a string of, in this example AAAA
Maybe I wasn't clear, all I want is the first sequence of letters, I don't want the numbers at all, and I surely don't want to concatenate them. So my desired result is a string of, in this example AAAA
What about InStr with Left?
sBigStr = "AAAAAA 9999"
sShortStr = Left$(sBigStr, InStr(sBigStr, " ") - 1)
sBigStr = "AAAAAA 9999"
sShortStr = Left$(sBigStr, InStr(sBigStr, " ") - 1)
the instr examples above will do that, my holder example above will also give you what you want.
ASKER
I thought I already tried that, but trying your example worked. Thanks to everyone who submitted comments, jrspano was the first to respond.
Thanks again
-m
Thanks again
-m
s = join(array)
this will make the array concatinated together with no spaces between then
s = Join(array,"delimiter")
will join with delimiter between words