Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - VBScript: Strings, You Can`t Function with...
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 
VeriSign Whitepapers 
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: Strings, You Can`t Function without Them
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-04-28

    Table of Contents:
  • VBScript: Strings, You Can`t Function without Them
  • LTrim That Hair You Hippie!
  • Trim()ming the Fat
  • Comparing Strings
  • The String Function
  • StrReverse()

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    VBScript: Strings, You Can`t Function without Them - LTrim That Hair You Hippie!


    (Page 2 of 6 )

    Let's face it, we all could use a little trimming. On our left side, and well, on our right side too. I mean, if you lopped off like fifty pounds from my left side, I would turn into one of those bopper weeble bags that you punch and it just bounces right back up.

    Strings in VBScript can sometimes have the same problem. If you want to get rid of those extra spaces on the left side of a string, then LTrim is your friend. Your skinny, good-looking friend you love to hate. That bastard.


    <html>

    <body>

    <script type="text/vbscript">

    dim s

    s=" We are the Space Invaders! We have come to...well...invade your space! "

    document.write(LTrim(s)) & "<br />"

    </script>

    </body>

    </html>

    This deletes the spaces on the left hand side of the string, resulting in:

      We are the Space Invaders! We have come to...well...invade your space!

    RTrim...Like LTrim But on the Other Side!

    As the title says, RTrim() is the same as LTrim, only on the other side. There isn't really much else to say about it, so here it is in code:


    <html>

    <body>


    <script type="text/vbscript">

    dim s

    s=" We are the Space Invaders! We have come to...well...invade your space! "

    document.write(RTrim(s)) & document.write("Look out we've collided with some text because you ate our spaces!")

    </script>

    </body>

    </html>

    This gives us the result of:

      Look out we've collided with some text because you ate our spaces! We are the Space Invaders! We have come to...well...invade your space!

    More Windows Scripting Articles
    More By James Payne


       · Thanks for stopping by to read my article on String functions in VBScript. Here we...
     

    WINDOWS SCRIPTING ARTICLES

    - 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
    - Moving and Renaming Computers with Active Di...
    - Working with System Processes in WSH





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