Compare String with Strings

Reply

Join Date: Jun 2006
Posts: 1
Reputation: raman is an unknown quantity at this point 
Solved Threads: 0
raman raman is offline Offline
Newbie Poster

Compare String with Strings

 
0
  #1
Feb 5th, 2007
Hello Expertz

I am using following function to compare two string.But i want to compare String with strings list like:
str1="A"
str2="A,B,C,D"

  1. Public Function CompareString(ByVal str1 As String, ByVal str2 As String) As Boolean
  2. Dim i As Integer = 0
  3. For i = 0 To str2.Length - str1.Length
  4. If str2.Substring(i, str1.Length) = str1 Then
  5. Return True
  6. End If
  7. Next i
  8. Return False
  9. End Function
  10.  
  11. Function Calling//
  12. If CompareString(Session("directoratename"), direcgrp) = True Then
  13. flag = 1
  14. Response.Redirect("Client_Menu.aspx?id=" & linkid & "&flag=" & Common.encrypt(flag))
  15. Else
  16. flag = 0
  17. Response.Redirect("Client_Menu.aspx?id=" & linkid & "&flag=" & Common.encrypt(flag))
  18. End If

Please let me how to do this using function.......

Many Thanks
Regards
Raman
Last edited by WaltP; Feb 5th, 2007 at 4:18 pm. Reason: Use Code Tags!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC