File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes length of the string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

length of the string

s john smith

Joined: Jan 12, 2012
Posts: 16

how to find the nuber of characters in the string without using length() or any standard library function?
Rod Singh

Joined: Feb 10, 2012
Posts: 16
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

That works if you don't count toCharArray as a "standard library function". Which is fine with me, it's up to the question-setter to define what a "library function" is and how you tell whether it's "standard" or not.
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Please UseOneThreadPerQuestion.(⇐click)

You've already been told it's not possible. If you don't like the answers you got, please discuss them in that thread, rather than starting a new one with the same question.
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Rod Singh wrote:

How is String.toCharArray() not a "standard library function"?
Matthew Brown

Joined: Apr 06, 2010
Posts: 4339

Duplicate of

(Locking this thread)
I agree. Here's the link:
subject: length of the string
Similar Threads
maximum length of String = 32k ?
amount of digits entered(without a tokenizer)....
NumberFormatException using line.substring
String.length() returns strange results