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
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
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.
Summary: Not sure why you'd use string arrays?? While you could implement a linked list with arrays, a feature of dynamically allocated linked lists is that you don't have array size problems and inserting/del...
Summary: Is there a way to get different pitches of the beep in C++ ? I am a beginner and I want to write a sort of a piano program.. I want it to beep as long as I press and hold a key. and i want each key to...