Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - VBScript: More String 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 
Actuate Whitepapers 
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: More String Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2008-04-21

    Table of Contents:
  • VBScript: More String Functions
  • Left Behind
  • Right Ahead
  • The Middle Man
  • Left, Right, Mid…Using Them in a Stupid Way
  • Space() Not Really the Final Frontier After All

  • 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

    Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!

    VBScript: More String Functions - Right Ahead


    (Page 3 of 6 )

    The Right() function works like the Left() function except that it takes characters starting from the right hand side. The easiest way to explain it is to show it in action:


    <html>

    <body>

    <script type="text/vbscript">

    document.write(Right("Yo mama so ugly she made an onion cry",9))

    </script>

    </body>

    </html>

    This code counts back from the end of the sentence, grabs the last nine characters and gives us the result of:

      onion cry

    Once again, you can also use it on variables, like so:


    <html>

    <body>

    <script type="text/vbscript">

    ugly="Yo mama so ugly she made an onion cry"

    document.write(Right(ugly,9))

    </script>

    </body>

    </html>

    Giving us the same result as before:

      onion cry

    And if we enter in too many characters to parse:


    <html>

    <body>

    <script type="text/vbscript">

    ugly="Yo mama so ugly she made an onion cry"

    document.write(Right(ugly,10000))

    </script>

    </body>

    </html>

    It simply prints the whole string:

      Yo mama so ugly she made an onion cry

    More Windows Scripting Articles
    More By James Payne


       · Thanks for dropping by for another episode in our series on VBSCript String...
     

    WINDOWS SCRIPTING ARTICLES

    - 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
    - VBScript: Functioning with Strings
    - Working with the Windows Registry in C++
    - Understanding Objects
    - HTML Applications: Giving WSH a User Interfa...
    - Modifying Computer Objects with Active Direc...
    - Logon Script to Send Email Notifications
    - Securing Computers and Active Directory

    Iron Speed




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