on 03-19-2007 9:13 AM
How to convert string to String[]
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
String s = "my string";
String[] sAsArray = new String[];
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.