File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes class method and strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "class method and strings" Watch "class method and strings" New topic
Author

class method and strings

Kenedy Grifin
Greenhorn

Joined: Dec 15, 2004
Posts: 1
Hi all,

I am trying to create a class method that takes a string and returns an array of integers, maybe alphabetical letters and should include upper and lower cases, could anyone give me any ideas, this is my firs java class
[ December 15, 2004: Message edited by: Kenedy Grifin ]
J Williams
Greenhorn

Joined: Nov 13, 2004
Posts: 10
You might as well bookmark the link to the Java API: Java API

If you look under String, you will find a method that I think you will see could be very helpful to you called toCharArray()

The java API is your friend. When I need to to something that I don't know how to do in java, I usually go to the API and search around to see if I can find something useful there. Nine times out of ten there is a class or method in the API that I can use. This is also a great way to learn. Hope this helps.


"Three people cannot keep a secret." SCJP 1.4
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If this is your first Java class, this question would probably be more appropriate in the Java in General (beginner) forum. Also, you haven't provided enough information for us to help you very much. What exactly does this method do? How does it create the integer array from the String that is passed as a parameter?

Even before you start figuring that out, you should probably work on the syntax for creating a class and declaring a method inside of it. Have you done this much yet? If so, does your code compile? What problems have you encountered? Is there any part of the sytnax you understand?

Hopefully these questions will help you think about what you need to do to write this program. Please come back with specific questions about what you are trying to do. The more information you can provide about your particular problem, the better we can help you figure out a solution to it.

Keep coding!

Layne


Java API Documentation
The Java Tutorial
sarada konda
Greenhorn

Joined: Dec 10, 2004
Posts: 7
String str= new String("javaRanch");
int [] strArr = new int[str.length()];
for(int i=0;i<str.length();i++)
strArr[i]=(int)str.charAt(i);


This may help u out
 
Don't get me started about those stupid light bulbs.
 
subject: class method and strings
 
Similar Threads
Object
deprecated methods
Events
How to call a stand alone class from WAS???
java.lang.OutOfMemoryError: PermGen space