Mike
I am sorry to say I am not fluent in VB:
But this section in your script:
if ((i >=65) and (i <=90)) Then
IsLetter = true ' Upper case letters
End if
if ((i >=97) and (i <=122)) Then
IsLetter = True ' Lower case letters
End if
I need characters ������
(DOS 143 142 153 134 132 148),
(win 0197 0229 0196 0228 0214 0246) my presumation this international
char that varies by countri should maybe be put in a list to they
qualify as Letter to, but How do I do iT I am sorry to ask
Gunnar Ekblad
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MikeB
Sent: den 8 december 2004 17:14
To: RBG7-L Mailing List
Subject: [RBG7-L] - Re: Label Text Formatting
Ok.. Now mckibben and mccomb become McKibben and McComb
'Option explicit
'msgbox CapitalizeValue(WScript.Arguments(0))
'wscript.quit()
Function CapitalizeValue(sStringIN)
Dim i
Dim s
Dim sNewName
Dim sChar
Dim arString
Dim bIsCapital
Dim bCapitalizeNext
'Get rid of:
' leading or trailing blanks,
' Double Spaces, space comma space
' Existing Caps
sStringIN = Replace(sStringIN,","," , ")
sStringIN = Trim(LCase(DropDblSpace(sStringIN)))
' replace comma with space comma space to preserve comma
if sStringIN = "" then
CapitalizeValue = sStringIN
end if
bCapitalizeNext = true
For i = 1 to Len(sStringIN)
sChar = Mid(sStringIN,i,1)
if (bCapitalizeNext = true) then
if IsLetter(sChar) = true then
sChar = UCase(sChar)
bCapitalizeNext = False
else
bCapitalizeNext = True
end if
else
if IsLetter(sChar) = false then
bCapitalizeNext = true
end if
end if
sNewName = sNewName & sChar
Next
' Check for Roman Numerals as Last element of sNewName
arString = Split(sNewName," ")
if ubound(arString) > 0 then
for i = 0 to ubound(arString)
arString(i) = Trim(arString(i))
if isRoman(arString(i)) = True then
arString(i) = ucase(arString(i))
else
If UCase(Left(arString(i),2)) = "MC" Then
s = arString(i)
arString(I) = ( UCase(Mid(s,1,1)) & LCase(Mid(s,2,1)) &
UCase(Mid(s,3,1)) & LCase(Mid(s,4,Len(s)-3)))
End if
end if
next
for i = 0 to ubound(arString)
If (arString(i) <> "") or (arString(i) <> " ") then
if arString(i) <> "," then
CapitalizeValue = CapitalizeValue & " " & arString(i)
else
CapitalizeValue = CapitalizeValue & arString(i)
end if
End if
Next
else
CapitalizeValue = sNewName
end if
CapitalizeValue = Trim(Replace(CapitalizeValue,",",", "))
end Function
function DropDblSpace(sStr)
Dim s
Dim r
s = Chr(20) & Chr(44)
r = Chr(44)
while InStr(sStr,s) > 0
sStr = Replace(sStr,s,r)
wend
While Instr(1,sStr," ") > 0
sStr = Replace(sStr, " ", " ")
wend
DropDblSpace = sStr
end function
function IsLetter(sChar)
Dim i
i = CInt((Asc(sChar)))
IsLetter = False
if ((i >=65) and (i <=90)) Then
IsLetter = true ' Upper case letters
End if
if ((i >=97) and (i <=122)) Then
IsLetter = True ' Lower case letters
End if
end function
Private Function IsRoman(ByVal sStr)
Dim i
Dim s
IsRoman = TRUE
s = Trim(UCase(sStr))
for i = 1 to len(s)
if inStr(1, "MDCLXVI", mid(s,i,1)) = 0 then
isRoman = False
exit For
end if
Next
End Function