06-14-2004 06:01 PM - edited 03-13-2019 05:15 AM
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.
06-14-2004 08:06 PM
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
06-15-2004 06:27 PM
Thanks a lot Yogeswar,
I got this working.
Thanks again for all your help.
Radhika.
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