implementation of java methods in C

January 16, 2009 at 09:35:17
Specs: Windows XP, 2.00Ghz
I need code for the JAVA methods
indexOf() and lastIndexOf() including its overloaded functions (totally 8
int indexOf(int ch)
int lastIndexOf(int ch)
int int indexOf(String str)
int lastIndexOf(String str)
int indexOf(int ch,int startIndex)
int lastIndexOf(int ch,int startIndex)
int indexOf(String str,int startIndex)
int lastIndexOf(String str,int startIndex)
)in C language

See More: implementation of java methods in C

Report •

January 16, 2009 at 10:35:15
The methods of which class?

I assume you mean String.

Then have a look at std::string. It is a large class and has many similar methods, so you'll need to spend some time reading through all the documentation. You possibly won't find exact equivalents to the Java methods but you'll still be able to do what you need.

Sorry I misread your post and thought you were asking about C++. In C, have a look at strchr, strrchr, and strstr.

Report •

January 19, 2009 at 07:14:02
Thank you for answering my question.
Yes i want the methods of string class
and i want to write the code for those instead of using predefined functions.
Ofcourse i tried them first.
I atleast want the hint for finding the index of string.
The function should just do the same function as the methods of JAVA.

Report •

January 22, 2009 at 11:27:58
Use pointers and write your own, if they don't exist.

Report •

Related Solutions

Ask Question