Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - VBScript: Converting and Formatting with F...
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 
Mobile Linux 
App Generation ROI 
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: Converting and Formatting with Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-05-27

    Table of Contents:
  • VBScript: Converting and Formatting with Functions
  • The Function with Character
  • Express Your In(teger) Self
  • CSng, the Loneliest Function of them All!
  • Witchy Woman Put a Hex On You

  • 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: Converting and Formatting with Functions - The Function with Character


    (Page 2 of 5 )

    If you need to convert a specific ANSI code to a character, you can use the Chr() function to do so. Here are some examples:


    <html>

    <head>

    <script type="text/vbscript">

    document.write(Chr(32) & "<br />")

    document.write(Chr(33) & "<br />")

    document.write(Chr(34) & "<br />")

    document.write(Chr(35) & "<br />")

    document.write(Chr(36) & "<br />")

    document.write(Chr(37) & "<br />")

    document.write(Chr(38) & "<br />")

    document.write(Chr(39) & "<br />")

    document.write(Chr(40) & "<br />")

    document.write(Chr(41) & "<br />")

    document.write(Chr(42) & "<br />")

    document.write(Chr(43) & "<br />")

    document.write(Chr(44) & "<br />")

    document.write(Chr(45) & "<br />")

    document.write(Chr(46) & "<br />")

    document.write(Chr(47) & "<br />")

    document.write(Chr(48) & "<br />")

    document.write(Chr(49) & "<br />")

    document.write(Chr(50) & "<br />")

    document.write(Chr(51) & "<br />")

    document.write(Chr(52) & "<br />")

    document.write(Chr(53) & "<br />")

    document.write(Chr(54) & "<br />")

    document.write(Chr(55) & "<br />")

    document.write(Chr(56) & "<br />")

    document.write(Chr(57) & "<br />")

    document.write(Chr(58) & "<br />")

    document.write(Chr(59) & "<br />")

    document.write(Chr(60) & "<br />")

    document.write(Chr(61) & "<br />")

    document.write(Chr(62) & "<br />")

    document.write(Chr(63) & "<br />")

    document.write(Chr(64) & "<br />")

    document.write(Chr(65) & "<br />")

    document.write(Chr(66) & "<br />")

    document.write(Chr(67) & "<br />")

    document.write(Chr(68) & "<br />")

    document.write(Chr(69))

    </script>

    </head>

    <body>

    </body>

    </html>

    This long-winded code will give the following result:

      !
      "
      #
      $
      %
      &
      '
      (
      )
      *
      +
      ,
      -
      .
      /
      0
      1
      2
      3
      4
      5
      6
      7
      8
      9
      :
      ;
      <
      =
      >
      ?
      @
      A
      B
      C
      D
      E 

    Okay, so maybe I shouldn't have added in the breaks. Here is a smarter example:


    <html>

    <head>

    <script type="text/vbscript">

    document.write(Chr(71))

    document.write(Chr(105))

    document.write(Chr(118))

    document.write(Chr(101))

    document.write(Chr(32))

    document.write(Chr(65))

    document.write(Chr(108))

    document.write(Chr(108))

    document.write(Chr(32))

    document.write(Chr(84))

    document.write(Chr(111))

    document.write(Chr(32))

    document.write(Chr(77))

    document.write(Chr(69))

    document.write(Chr(33))

    document.write(Chr(33))

    document.write(Chr(33))

    </script>

    </head>

    <body>

    </body>

    </html>

    Again, here is the result of our chatty code:

    Give All To ME!!!

    More Windows Scripting Articles
    More By James Payne


       · In our last tutorial, I tried to cover as many of the Conversion and Formatting...
     

    WINDOWS SCRIPTING ARTICLES

    - 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...
    - Modifying XML Files in WSH
    - Reading XML Files in WSH
    - Visual Basic 2005 XML Programming Using XML ...
    - Creating an XML Document in WSH
    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT