consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

A Coder's Notes

Email :
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull

Get connected and Online Tottington
remote management Makerfield code and design Aspull

ASP.NET Useful Split Function (Good for Date Formats) - 11/03/2011

Found this looking through another coder's code...useful

<script runat = "server">

sub page_load
 dim x as string = "01/07/2011"

 dim y as array = split(x, "/")

 response.write(y(0) & " then " & y(2) & " then " & y(1))
end sub


This will produce

01 then 2011 then 07

It's "SPLIT" that's the useful bit.  Any string with a common seperator, such as dates, CSV files and even text with it's spaces can be split along that seperator into an array. 

The syntax is split(string-to-split, string-or-character-to-split-by)


split(mystring, ",") would split comma seperated stuff
split(mystring, " ") would split text into an array by the spaces

Post A Comment

Name Comment
programming services specialist
Valid XHTML 1.0 Transitional