I have a ASP has a Function that converts
ä to ä so far so good.
I have lets say space for 10 char's if there are more cut them of if there are less fill the space up with  's. . Like this:
test            
but if i say "täst" it does this:
te ä t  
It interprets the ä not as one char it looks at it as 6 chars. Is there a clever way around that? This problem messes up my design because I need the right count of spaces. The whole thing goes into a big select box.
Of you have to开发者_JS百科 add a ; at the end of ever &... I could add them because the Editor would really interprt them.
Could you count the characters before you convert them?
So with the example of "täst
", you would determine that you will need 6  's
. then convert the characters (te ä t
), then append the  's
(te ä t            
).
Something like ? Don't shoot me of you get small errors, I can't test it now (don't have a server here) so so it's coded from heart:
function CountChars ( byval s )
dim i, inAmp, Result
Result = 0
inAmp = False
for i = 1 to len(s)
select case mid(s,i,1)
case "&"
Result = Result + 1
inAmp = True
case ";"
if inAmp then inAmp = False
case else
if not inAmp then Result = Result + 1
end select
next
CountChars = Result
end function
精彩评论