07-30-2010 02:20 AM - edited 03-14-2019 06:11 AM
Dear all Master,
I need Your help please.
Topic:
Script Editor.
My System:
-CUCM 7.0
-UCCX 7.0 premium
-Nuance recognizer 9.0
Question:
ABC = string var.
ABC = "this is sample"
2 space character in ABC string var.
How to find out how many space character in ABC var ?
Regards,
Susanto
Solved! Go to Solution.
07-30-2010 02:51 AM
Hi
Create a int variable called whatever you want, then insert a SET step.
Set the variable to the new int you created, and then paste this into the 'value' field:
{
String[] myarray = teststring.split(" ");
return myarray.length -1 ;
}
Basically it splits the string into chunks each time it hits the " " character.
This results in an array of the resulting chunks (i.e. words), which is one more than the number of spaces. -1 from that, and you have your int variable set to the number of spaces.
Regards
Aaron
Please rate helpful posts...
07-30-2010 02:51 AM
Hi
Create a int variable called whatever you want, then insert a SET step.
Set the variable to the new int you created, and then paste this into the 'value' field:
{
String[] myarray = teststring.split(" ");
return myarray.length -1 ;
}
Basically it splits the string into chunks each time it hits the " " character.
This results in an array of the resulting chunks (i.e. words), which is one more than the number of spaces. -1 from that, and you have your int variable set to the number of spaces.
Regards
Aaron
Please rate helpful posts...
08-01-2010 07:00 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide