TeleFlow Forums
http://teleflow.org/phpbb/

How to count expressions in sentence
http://teleflow.org/phpbb/viewtopic.php?f=10&t=247
Page 1 of 1

Author:  telephony [ Wed Apr 27, 2005 8:30 pm ]
Post subject: 

How can I count the number to expressions in a string variable. For instance, if I have @TEXT=this sentence has 5 words, what can I do so that I can specify @COUNT_TEXT=5. I also need to be able to specify what word is in which position, i.e. @COUNT1=this, @COUNT2=sentence, etc. <br> <br>Please help.

Author:  Awgeewhiz [ Thu Apr 28, 2005 6:42 am ]
Post subject: 

I would suggest using the parse step to locate the space character that separates the words then use the math step to extract them.

Author:  telephony [ Mon May 02, 2005 5:57 pm ]
Post subject: 

Thanks for the tip. At first thought, this sounds rather tedious. Any more direct way of achieving the same? In any case, I'd have a go at it and see how it goes. <br> <br>Thanks!

Author:  Chris [ Tue May 03, 2005 9:36 am ]
Post subject: 

Instead of using math to extract each variable, use the Parse step as follows: <br> <br>Set <br> <br>@MY_TEXT = <br>Parse @TEXT <br>Delimiting string @SPACE (@SPACE contains a single space character) <br>For occurrence # @COUNT (a count you incremement yourself each time parse successfully retrieves a string) <br> <br>That is a fairly easy way to get the count, and each individual word. What it doesn't do is simplify you @COUNT1 , @COUNT2 process. Could you explain why you are doing this? Perhaps we can provide a better method if we understand the purpose of noting the text at each position. <br> <br>NOTE: You can use parse to immediately give you the text at a particular position by simply setting it up the same way as above, and setting occurrence # to the particular position you are looking for.

Author:  telephony [ Wed May 04, 2005 10:00 pm ]
Post subject: 

We're trying to create a sort of a callback application using TF. Users will key-in a string of phone numbers they want to callback on and the system will call them individually, i.e. if user input +1416222222 +16044840604 +44207221111, we need to have @COUNT1=1416XXXXX, @COUNT2=1604XXXX, and @COUNT3=44207XXX, etc. I know it's easier to have callers in the variables in 3 times then to have them in all at once but it's something the customer specifically requested. <br> <br>TF will then pass on these numbers individually to a VOIP server and make 3 outgoing calls.

Author:  Chris [ Thu May 05, 2005 9:33 am ]
Post subject: 

If you are going to gather all of the numbers into a single variable/string delimited by spaces, and subsequently pull them out of that string one at a time to pass them to something else, I think you can use the method I described. <br> <br>Rather than storing each number to a separate variable, use the Parse for delimiting string method to get the first phone number, do whatever needs to be done to send it the the VOIP server, get the second one, send it the VOIP server, etc. It amounts to the same thing.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/