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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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: 2 stars2 stars2 stars2 stars2 stars / 3
    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

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek