Select the contents in sorted Array depending on first letter ... VB Script / ASP

milani_lucie
milani_lucie used Ask the Experts™
on
Hi,

I have a sorted array of strings. If i select the first letter (let us say "C") then i need to get all the strings that start with that first letter (Ex: CAT etc...). Can you please provide me the code for that ? BTW: I am using classical ASP. So i need it in VB Script.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Web Ninja at large
Commented:
you'd have to loop through each element, then check the first letter of each string:

for each str in arrStrings
   if Left( UCase( str ), 1 ) = "C" then
       Response.Write str & "<br/>"
   end if
next

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial