mardi 20 mars 2012
ASP: the split function and arrays
Do you like this story?
The ASP split function is used to - guess what - split a string into specific parts. The resulting number of items is variable and depends on how we use the function.
Basically the split function has the following syntax:
VarArray = split(string, delimiter, numberOfItems)1) string is the string to be split;
2) delimiter is the element used to determine where to split the string;
3) numberOfItems is optional and limits the number of returned items in the array.
Let's see some examples.
<%
Dim VarString
Dim VarArray 
VarString = "Welcome to The Web Thought!"
VarArray = split(VarString, " ")
For each item in VarArray
  response.write(item & "<br>")
Next
%>Welcome
to
The
Web
Thought!split(VarString, " ", 3)Welcome
to
The Web Thought!A1;A2;A3;A4VarArray = split("A1;A2;A3;A4", ";")A1
A2
A3
A4I hope you've found the above information useful for your projects. In the meantime, happy programming!

This post was written by: Franklin Manuel
Franklin Manuel is a professional blogger, web designer and front end web developer. Follow him on Twitter
Inscription à :
Publier les commentaires (Atom)


0 Responses to “ASP: the split function and arrays”
Enregistrer un commentaire