Results 1 to 3 of 3
Thread: Help with Vectors and Strings...
- 12-08-2007, 08:32 AM #1
Member
- Join Date
- Dec 2007
- Posts
- 3
- Rep Power
- 0
Help with Vectors and Strings...
Hey all,
I am having problems with getting proper size Strings from a Vector. I have this function:
If I do a function call:Java Code:public static String HandleUsername(Vector name, Vector address, Vector port, DatagramPacket user) { InetAddress a = user.getAddress(); String p = Integer.toString(user.getPort()); for (int i = 0; i < name.size(); i++) { if (address.elementAt(i).toString().equals(a.toString()) == true && port.elementAt(i).toString().equals(p) == true) { return (String)name.elementAt(i); } } return "/fail"; }
The size of that string s is always 65504 if I use s.length(). Why does this happen? Basically when I try pull the String from a Vector it gives me a max size (I think?) String. How do I get the actual size of the String?Java Code:String s = HandleUsername(name, address, port, user)
- 12-09-2007, 01:40 AM #2
Member
- Join Date
- Dec 2007
- Posts
- 3
- Rep Power
- 0
Any ideas?
- 12-09-2007, 09:04 AM #3
Member
- Join Date
- Dec 2007
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Vectors of Vectors or hash-somethings?
By mindwarp in forum New To JavaReplies: 3Last Post: 03-10-2008, 02:57 PM -
Can't access two vectors independantly?
By splinter64uk in forum New To JavaReplies: 2Last Post: 11-28-2007, 11:57 PM -
Vectors vs ArrayList
By Java Tip in forum Java TipReplies: 0Last Post: 11-28-2007, 10:29 AM -
Understanding Vectors
By cbrown08 in forum New To JavaReplies: 7Last Post: 11-05-2007, 06:56 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks