cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
225
Views
5
Helpful
2
Replies

A string of digits into separate digits in ivr

rnarayana
Level 5
Level 5

Hello,

Is I have string of numbers such as "06122004" ,is it possible to separate the digits ie as 06,15 and 2004?

Thanks,

Radhika.

2 Replies 2

yogeswar
Level 4
Level 4

Hi Radhika,

Hope I addressed the same logic before in my previous responses to you.

You have to use Execute Java Method Step to separate the characters from string variable. The procedure is as follows...

1. X is a string variable with a value "06122004".

2. Create three string variables strX1, strX2 and strX3.

3. Use "Execute Java Method" step.

Select Variable : X

Method Name : SubString(int,int)

Argument#0 : 0

Argument#1 : 2

Assign To Variable : strX1

4. When the step 3 gets executed, strX1 will have the value "06".

5. similarly to extract "12", the argument#0 :2 and argument#1 :4.

6. To extract "2004", the argument#0 :4 and argument#1 :8.

7. In order to convert the above string StrX1, StrX2 and strX3 into integer value use the following...

create 3 integer variables as intX1, intX2 and intX3.

Step : Execute Java Method

Select Variable : intX1

Method : int parseInt(String)

Argument#0 : StrX1

Assign To variable : intX1

8. When step 7 gets executed the value of intX1 is 6. Follow the same procedure for other two strings StrX2 and StrX3 and store the integer values in intX2 and intX3 respectively.

Hope it helps.

Regards

Yogi

Thanks a lot Yogeswar,

I got this working.

Thanks again for all your help.

Radhika.