p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: strconv omited in Vbscript, but I am desperately in need.


Message #1 by Floyd Hunag <flloid@p...> on Mon, 26 Feb 2001 21:11:27 +0800
2 seconds with the knowledge base will give you:

http://support.microsoft.com/support/kb/articles/Q110/3/91.asp


'**********************************************************
    ' Declarations section of the module
    '**********************************************************
       Option Explicit
    '==========================================================
    ' The following function is designed for use in the AfterUpdate
    ' property of form controls.
    ' Features:
    '    - Leading spaces do not affect the function's performance.
    '    - "O'Brian" and "Wilson-Smythe" will be properly capitalized.
    ' Limitations:
    '    - It will change "MacDonald" to "Macdonald."
    '    - It will change "van Buren" to "Van Buren."
    '    - It will change "John Jones III" to "John Jones Iii."
    '==========================================================
    Function Proper (AnyValue As Variant) As Variant
       Dim ptr As Integer
       Dim TheString As String
       Dim currChar As String, prevChar As String

       If IsNull(AnyValue) Then
          Exit Function
       End If

       TheString = CStr(AnyValue)
       For ptr = 1 To Len(TheString)         ' Go through each char. in
                                             ' string.
       currChar = Mid$(TheString, ptr, 1)    ' Get the current character.

          Select Case prevChar               ' If previous char. is a
                                             ' letter,'this char. should be
                                             ' lowercase.
          Case "A" To "Z", "a" To "z"
             Mid(TheString, ptr, 1) = LCase(currChar)

          Case Else
             Mid(TheString, ptr, 1) = UCase(currChar)

       End Select
       prevChar = currChar
       Next ptr
       AnyValue = theString
    End Function





At 06:26 PM 2/26/01, you wrote:
>This is a multi-part message in MIME format.
>
>--Boundary_(ID_LM/RbJkPSJ8zKB+nbH10Mw)
>Content-type: text/plain; charset=Windows-1252
>Content-transfer-encoding: 7BIT
>
>Vbscript omited the strconv function in VB, but I need to do the job 
>strconv does. Like the following statements:
>strTmp = StrConv(strValue,vbUnicode)
>Anyone knows how to do it in VBscript or in Jscript?
>
>Thanks.
>
> >From ed.
>
>--Boundary_(ID_LM/RbJkPSJ8zKB+nbH10Mw)
>Content-type: text/html; charset=Windows-1252
>Content-transfer-encoding: 7BIT
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>Vbscript omited the strconv function in VB, but I need to do the job 
>strconv does. Like the following statements:
>strTmp = StrConv(strValue,vbUnicode)
>Anyone knows how to do it in VBscript or in Jscript?
>
>Thanks.
>
> From ed.
>
>--Boundary_(ID_LM/RbJkPSJ8zKB+nbH10Mw)--


Robert Chartier
Author, AspFree.com
xxx-xxx-xxxx
rchartierh@a...
http://www.aspfree.com/devlinks
http://www.aspfree.com/authors/robert
http://www.aspalliance.com/nothingmn


  Return to Index