How to get subString with Split function.

View: New views
4 Messages — Rating Filter:   Alert me  

How to get subString with Split function.

by Cynthia Li :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi,
Anyone could help me to resolve this problem??Thanks
--------------------
My JMeter Version is 2.3.2
I have a string like string="wap/test.do?n=123&testName=test2" ,and I want
to get the substring and split with character '='
My define a variable as subString= ${__split(${string},subString),=}
subString_1=wap/test.do?n
subString_2=123&testName
subString_3=test2
I think it is right ,but System will return a null subString when I try to
get value of  ${subString_3}.Where is wrong??

--
Best Regards,
Cynthia Lee
Ice Breaker China, Inc.
Tel:  86-10-82800942-815
Fax: 86-10-82800941

Re: How to get subString with Split function.

by Deepak Shetty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi
${__split(${string},subString,=)}
You can always use a debug sampler(with view results tree listener) to check
what values your variables have, also you should check jmeter logs
regards
deepak

2009/11/5 Cynthia Li <cynthia.li@...>

> hi,
> Anyone could help me to resolve this problem??Thanks
> --------------------
> My JMeter Version is 2.3.2
> I have a string like string="wap/test.do?n=123&testName=test2" ,and I want
> to get the substring and split with character '='
> My define a variable as subString= ${__split(${string},subString),=}
> subString_1=wap/test.do?n
> subString_2=123&testName
> subString_3=test2
> I think it is right ,but System will return a null subString when I try to
> get value of  ${subString_3}.Where is wrong??
>
> --
> Best Regards,
> Cynthia Lee
> Ice Breaker China, Inc.
> Tel:  86-10-82800942-815
> Fax: 86-10-82800941
>

Re: How to get subString with Split function.

by Cynthia Li :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Deepak, I update my function as your suggestion,but it doesn't work.
And how to set a log for reading my parameter's value?
2009/11/6 Deepak Shetty <shettyd@...>

> hi
> ${__split(${string},subString,=)}
> You can always use a debug sampler(with view results tree listener) to
> check
> what values your variables have, also you should check jmeter logs
> regards
> deepak
>
> 2009/11/5 Cynthia Li <cynthia.li@...>
>
> > hi,
> > Anyone could help me to resolve this problem??Thanks
> > --------------------
> > My JMeter Version is 2.3.2
> > I have a string like string="wap/test.do?n=123&testName=test2" ,and I
> want
> > to get the substring and split with character '='
> > My define a variable as subString= ${__split(${string},subString),=}
> > subString_1=wap/test.do?n
> > subString_2=123&testName
> > subString_3=test2
> > I think it is right ,but System will return a null subString when I try
> to
> > get value of  ${subString_3}.Where is wrong??
> >
> > --
> > Best Regards,
> > Cynthia Lee
> > Ice Breaker China, Inc.
> > Tel:  86-10-82800942-815
> > Fax: 86-10-82800941
> >
>



--
Best Regards,
Cynthia Lee
Ice Breaker China, Inc.
Tel:  86-10-82800942-815
Fax: 86-10-82800941

Re: How to get subString with Split function.

by Deepak Shetty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok i just tried this as
Thread Group
+User Defined variables
++string         wap/test.do?n=123&testName=test2
++test            ${__split(${string},subString,=)}
+Debug Sampler ( Add --> sampler --> debug sampler)
+View Results Tree (Add listener --> view results tree0

And the View Results Tree Response tab for the Debug sampler shows the
values as expected.
If it isnt working for you perhaps you can tell us the structure of your
test, how / where you are invoking this function

regards
deepak



2009/11/9 Cynthia Li <cynthia.li@...>

> Thanks Deepak, I update my function as your suggestion,but it doesn't work.
> And how to set a log for reading my parameter's value?
> 2009/11/6 Deepak Shetty <shettyd@...>
>
> > hi
> > ${__split(${string},subString,=)}
> > You can always use a debug sampler(with view results tree listener) to
> > check
> > what values your variables have, also you should check jmeter logs
> > regards
> > deepak
> >
> > 2009/11/5 Cynthia Li <cynthia.li@...>
> >
> > > hi,
> > > Anyone could help me to resolve this problem??Thanks
> > > --------------------
> > > My JMeter Version is 2.3.2
> > > I have a string like string="wap/test.do?n=123&testName=test2" ,and I
> > want
> > > to get the substring and split with character '='
> > > My define a variable as subString= ${__split(${string},subString),=}
> > > subString_1=wap/test.do?n
> > > subString_2=123&testName
> > > subString_3=test2
> > > I think it is right ,but System will return a null subString when I try
> > to
> > > get value of  ${subString_3}.Where is wrong??
> > >
> > > --
> > > Best Regards,
> > > Cynthia Lee
> > > Ice Breaker China, Inc.
> > > Tel:  86-10-82800942-815
> > > Fax: 86-10-82800941
> > >
> >
>
>
>
> --
> Best Regards,
> Cynthia Lee
> Ice Breaker China, Inc.
> Tel:  86-10-82800942-815
> Fax: 86-10-82800941
>