Aug 31, 2006 #1 Kendel Programmer Joined Apr 24, 2002 Messages 1,512 Location US Hi All: How do I seperate the left & right of the string? My string looks like this: <%Str1, Str2%> I don't know the lenght of Str1 or Str2. Thanks.
Hi All: How do I seperate the left & right of the string? My string looks like this: <%Str1, Str2%> I don't know the lenght of Str1 or Str2. Thanks.
Aug 31, 2006 #2 rjoubert Programmer Joined Oct 2, 2003 Messages 1,843 Location US Code: YourString = "<%Str1, Str2%>" strLeft = Left(YourString, InStr(1, YourString, ",", 1) - 1) strRight = Mid(YourString, InStr(1, YourString, ",", 1) + 1, Len(YourString)) Upvote 0 Downvote
Code: YourString = "<%Str1, Str2%>" strLeft = Left(YourString, InStr(1, YourString, ",", 1) - 1) strRight = Mid(YourString, InStr(1, YourString, ",", 1) + 1, Len(YourString))
Aug 31, 2006 #3 Sheco Programmer Joined Jan 3, 2005 Messages 5,457 Location US You could also use the Split() function to create an array from the string, with the comma as the delimitter. That is probably overkill for just 2 values but for 3 or more it is a good idea. Upvote 0 Downvote
You could also use the Split() function to create an array from the string, with the comma as the delimitter. That is probably overkill for just 2 values but for 3 or more it is a good idea.
Sep 1, 2006 Thread starter #4 Kendel Programmer Joined Apr 24, 2002 Messages 1,512 Location US Thank you guys. Both solutions work for me but I'm uisng rjoubert's. Thanks again. Upvote 0 Downvote