Computing.Net > Forums > Programming > implementation of java methods in C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

implementation of java methods in C

Reply to Message Icon

Name: spani
Date: January 16, 2009 at 09:35:17 Pacific
OS: Windows XP
CPU/Ram: 2.00Ghz
Product: Hcl DESKTOP
Subcategory: Java
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: January 16, 2009 at 10:35:15 Pacific
Reply:

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.

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


0

Response Number 2
Name: spani
Date: January 19, 2009 at 07:14:02 Pacific
Reply:

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.


0

Response Number 3
Name: garyfletcher
Date: January 22, 2009 at 11:27:58 Pacific
Reply:

Use pointers and write your own, if they don't exist.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: implementation of java methods in C

Binary Search Tree in C www.computing.net/answers/programming/binary-search-tree-in-c/11634.html

Tone/Pitch/Beep in C++ www.computing.net/answers/programming/tonepitchbeep-in-c/2027.html

Switch statement code in C++ ..? www.computing.net/answers/programming/switch-statement-code-in-c-/6052.html