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

IT Services And Support

Email : ren@techsolus.co.uk
Mobile Phone : 0788 68 41 411
Answerphone : 01204 469683
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

</script>

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)

so

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 asp.net specialist
Valid XHTML 1.0 Transitional
Admin
GD