We moved our repositories to BitBucket!
If you can't login or you can't register to the forums do not rise an issue, instead please write to support (at) l2jserver.com
Check our wiki!
Report server issues here
Forum has been updated to phpBB 3.2, let's see if this fixes some minor bugs we had.
Thank you for visiting
http://www.l2jserver.com/
If something doesn't fit in any other forum then post it here.
-
KGB1st
- Posts: 223
- Joined: Sat Jul 26, 2014 5:58 pm
- Location: ИРК, РФ, СИБИРЬ!
-
Contact:
Post
by KGB1st » Fri Nov 13, 2015 3:55 pm
Code: Select all
String[] data = event.split(" ");
String[] val = data[1];
Why in 1st code data sets to the string value, but in 2nd method I got ex about that it can't convert?

-
LasTravel
- Advanced User

- Posts: 888
- Joined: Tue Jan 05, 2010 12:08 am
- Location: Spain
Post
by LasTravel » Sat Nov 14, 2015 8:01 am
Because data[1] is a String, not a String[], so you should use:
-
KGB1st
- Posts: 223
- Joined: Sat Jul 26, 2014 5:58 pm
- Location: ИРК, РФ, СИБИРЬ!
-
Contact:
Post
by KGB1st » Sat Nov 14, 2015 9:13 am
LasTravel wrote:Because data[1] is a String, not a String[], so you should use:
aaa.. this's such as dynmic sting (array)?
-
SaveGame
- Posts: 121
- Joined: Thu Oct 30, 2014 9:54 pm
Post
by SaveGame » Sat Nov 14, 2015 10:25 am
Java is strictly typed. String#split(String) returns String[], which is a simple array.
A String in Java is not an array (although in typical JDK implementations there is a cached char[] underneath).
Consider
Code: Select all
char[] val = data[1].toCharArray()