getpiyush19 Posted November 20, 2009 Report Share Posted November 20, 2009 I have some bits of string ,it has a substring occurring many time in that string .I want to store that substring into an array and want to count its number of occurrences in that string. I am using Match pattern function palette and while loop ,for loop still not able to implement the same Please help me out. Quote Link to comment
jcarmody Posted November 20, 2009 Report Share Posted November 20, 2009 Do you know what substring to detect or do you need to detect a repeating substring? Quote Link to comment
getpiyush19 Posted November 20, 2009 Author Report Share Posted November 20, 2009 Do you know what substring to detect or do you need to detect a repeating substring? Thanks for reply I know the substring to be detected Do you know what substring to detect or do you need to detect a repeating substring? Thanks for reply I know the substring to be detected. so how to proceed Quote Link to comment
jcarmody Posted November 20, 2009 Report Share Posted November 20, 2009 You were correct to use a loop, but a For Loop isn't correct unless you know exactly how many times the substring exists in the main string. I used a While Loop with the 'offset past match' to detect when to stop (it'll be -1 if the search string isn't found). I'm not sure what you mean about storing "that substring into an array", but you can wire the 'match substring' of the Search function to an indexing tunnel and you'll get an array of the substring with as many elements as there are occurrences. Quote Link to comment
getpiyush19 Posted November 23, 2009 Author Report Share Posted November 23, 2009 You were correct to use a loop, but a For Loop isn't correct unless you know exactly how many times the substring exists in the main string. I used a While Loop with the 'offset past match' to detect when to stop (it'll be -1 if the search string isn't found). I'm not sure what you mean about storing "that substring into an array", but you can wire the 'match substring' of the Search function to an indexing tunnel and you'll get an array of the substring with as many elements as there are occurrences. thanks sir it is working. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.