cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert string to String[ ]

Former Member
0 Kudos

How to convert string to String[]

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi yzme

String is an object in Java...Java gives various methods for operation on strings like

getting string length , concatenation etc...

wat functionality do you want for str[]....?? plz explain that or try achieving it through given functionality of String objects

Avinash

Please award points if it helps...

Answers (2)

Answers (2)

Former Member
0 Kudos

String s = "my string";

String[] sAsArray = new String[];

Former Member
0 Kudos

Hi,

If you have string (MyString)like this. u can convert it into string array

string MyString = "value1;value2;value3;value4;"

string[] MyStringArray = MyString.Split(';');

Thanks,

Lohi.

Former Member
0 Kudos

outMailBean.setMessages(request.getParameterValues("message"));

will give me >>>>>>>>> @139ba44 //String[]

outMailBean.setMessage(request.getParameter("message"));

will give me >>>>>>>>> mgm ter res 4 //String

i want to try whether or not it is correct if i convert @139ba44 will get

mgm ter res 4

Former Member
0 Kudos

Hi

Use string tokenizer with a delimeter which suits your requirement.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Yzme:

The '@139ba44' is an String Array Object. And you wants to conver it into String.

If you want String(s) from an Object[] use the followking code, it may help you:

//for a given Object[] obj

String[] str =new String[obj.length];

for (int i=0; i<str.length;i++)

{

str<i> = obj<i>.toString();

}

Hope this will answer your query. Points if helpfull answer..!

Tnx,

Munna_SAP