cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1221
Views
0
Helpful
3
Replies

String Array as Parameter

ecornwell
Level 2
Level 2

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!

1 Accepted Solution

Accepted Solutions

Tanner Ezell
Level 4
Level 4

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

View solution in original post

3 Replies 3

Tanner Ezell
Level 4
Level 4

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

That'll do exactly what I need!

Thanks!

*That's why I was never a developer! 

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
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: