Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

String Array as Parameter

Hello,

I'm trying to build a new String Array as a parameter but I can't seem to the syntax right to get it started with the specific values I need.  I've tried the following:

  • {"val1","val2","val3"}
  • new String[3] {"val1","val2","val3"}
  • val1,val2,val3
  • "val1","val2","val3"

Has anyone ever done this?

Thanks!

Everyone's tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: String Array as Parameter

I don't think thats going to work, but who cares. Try not to think

about the problem so linearly, for example instead of doing what your

doing try the following

String foo (as parameter)

String bar[]

bar = foo.split(",") // the comma is the separator

That's all you need. Pick a reasonable separator and put the values

into your foo string as a parameter

so if you put "var1,var2,var3" as foo via paramter

bar[0] becomes "var1", bar[1] becomes "var2", etc.

On Fri, Sep 10, 2010 at 3:45 PM, ecornwell

Tanner Ezell www.ctilogic.com
3 REPLIES

Re: String Array as Parameter

I don't think thats going to work, but who cares. Try not to think

about the problem so linearly, for example instead of doing what your

doing try the following

String foo (as parameter)

String bar[]

bar = foo.split(",") // the comma is the separator

That's all you need. Pick a reasonable separator and put the values

into your foo string as a parameter

so if you put "var1,var2,var3" as foo via paramter

bar[0] becomes "var1", bar[1] becomes "var2", etc.

On Fri, Sep 10, 2010 at 3:45 PM, ecornwell

Tanner Ezell www.ctilogic.com
Community Member

Re: String Array as Parameter

That'll do exactly what I need!

Thanks!

*That's why I was never a developer! 

Re: String Array as Parameter

Trust me, I never wanted to be a developer either I just got suckered

back into it

Cheers

On Fri, Sep 10, 2010 at 4:02 PM, ecornwell

Tanner Ezell www.ctilogic.com
736
Views
0
Helpful
3
Replies
CreatePlease to create content