ASP
  Home arrow ASP arrow Mimicking PHP's String Formatting Function...
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? 
ASP

Mimicking PHP's String Formatting Functions
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2004-06-21

    Table of Contents:
  • Mimicking PHP's String Formatting Functions
  • str_word_count and ucfirst
  • strip_tags
  • str_pad

  • 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


    Mimicking PHP's String Formatting Functions


    (Page 1 of 4 )

    ASP does not come with many string formatting options. We can find the length, make a string upper/lower case, and do some trimming and replacing, but not too much else. Often appearing in forums is the question "What's the ASP equivalent to PHP's [something] function?" This article will highlight a few formatting functions mimicking PHP, and maybe spur your creative mind on to creating more of your own.

    Introduction

    Anyone who has ever coded in PHP, knows how easy (and almost fun) it can be to work with strings. The creative minds behind the language realized there are some very common things people like to do with strings, so let's incorporate them right into the package. These include functions to strip HTML formatting, count words, perform smart case changes, and more.

    But suppose you make a switch, even a temporary one, to ASP. Perhaps just one application or one environment you work with is ASP driven. Well, much to your dismay, you're now on your own if you want any of these advanced string functions! ASP gives you all you need to trim or count the length of a string, but that's about it. This article will help you along with a number of those functions, and no doubt you'll be able to suggest a few of your own in the forum.

    For those of you who don't know or simply don't care what PHP has to offer (shame on you), you'll still find this article very handy. The ideas covered are no doubt things you've encountered in the past, and had to handle in a manual way. My objective here, is to provide some package-able, reusable functions that you can call on whenever you need. And no doubt after you've read of what they can do, you will need!

    I'll go through five PHP functions, what they do, and how to create an ASP equivalent. They are:

    • str_word_count
    • ucfirst
    • ucwords
    • strip_tags
    • str_pad

    They same imitation is the finest form of flattery, so let us proceed with flattering the PHP designers.

    More ASP Articles
    More By Justin Cook


     

    ASP ARTICLES

    - Using MySQL with ASP
    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application





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