Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - VBScript: Conversion and Format Functions
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

VBScript: Conversion and Format Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-05-19

    Table of Contents:
  • VBScript: Conversion and Format Functions
  • The Asc() Function
  • CBool...CBool Run
  • CCur...Did I Stutter? Oh Yeah, I Guess I Did
  • This Next Part Will Make You CDbl()

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    VBScript: Conversion and Format Functions - The Asc() Function


    (Page 2 of 5 )

    The Asc() is used to return the ANSI code for the first character in an expression. Here we use it to display the ANSI code for the letters a through f, both capitalized and lower case:


    <html>

    <body>

    <script type="text/vbscript">

    document.write(Asc("A") & "<br />")

    document.write(Asc("a") & "<br />")

    document.write(Asc("B") & "<br />")

    document.write(Asc("b") & "<br />")

    document.write(Asc("C") & "<br />")

    document.write(Asc("c") & "<br />")

    document.write(Asc("D") & "<br />")

    document.write(Asc("d") & "<br />")

    document.write(Asc("E") & "<br />")

    document.write(Asc("e") & "<br />")

    document.write(Asc("F") & "<br />")

    document.write(Asc("f"))

    </script>

    </body>

    </html>

    This gives us the result:

      65
      97
      66
      98
      67
      99
      68
      100
      69
      101
      70
      102

    You will note however that I said it gives us the ANSI code for the first character in an expression, so the following will result in the same output as the above, as it still only takes from that first character and not the entire (in this case) string:


    <html>

    <body>

    <script type="text/vbscript">

    document.write(Asc("Apple") & "<br />")

    document.write(Asc("ape") & "<br />")

    document.write(Asc("Banana") & "<br />")

    document.write(Asc("baboon") & "<br />")

    document.write(Asc("Chinchilla") & "<br />")

    document.write(Asc("chaquita") & "<br />")

    document.write(Asc("Doscile") & "<br />")

    document.write(Asc("digereedoo") & "<br />")

    document.write(Asc("Enoch") & "<br />")

    document.write(Asc("epoch") & "<br />")

    document.write(Asc("Funky") & "<br />")

    document.write(Asc("funkay"))

    </script>

    </body>

    </html>

    As stated above this gives us the same result:

      65
      97
      66
      98
      67
      99
      68
      100
      69
      101
      70
      102

    More Windows Scripting Articles
    More By James Payne


       · Welcome back. In this article we will cover Conversion and Formatting functions. If...
     

    WINDOWS SCRIPTING ARTICLES

    - A Portable Scripting Toolbox
    - WPF Through an Example: Introduction
    - Beginning SharePoint Web Part Development
    - More Alternative Languages for WSH
    - WPF Control Layout
    - WSH in Other Languages
    - Screen Capturing via GDI+ and GDI
    - Understanding Procedures in VBScript
    - Printing Documents in WSH
    - Generating Outlook Signatures Based on Activ...
    - VBScript: Converting and Formatting with Fun...
    - VBScript: Conversion and Format Functions
    - VBScript: Array Functions
    - VBScript: Strings, You Can`t Function withou...
    - VBScript: More String Functions





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway