What are the distinctions between StringBuilder in Java and StringBuilder in C#?


Joined
Jun 29, 2022
Messages
4
Reaction score
0
I'm in the process of porting Java code to C#. The StringBuilder class in Java appears to have many more methods than the one in C#. I'm curious about (say) the Java functionality.
Code:
sb.indexOf(s);
sb.charAt(i);
sb.deleteCharAt(i);

This appears to be lacking in C#
The first two, I think, may be modeled by
Code:
sb.ToString().IndexOf(s);
sb.ToString().CharAt(i);
Would the third, however, work on a replica of the sb's contents rather than the real contents?

Is there a standardized way to add this capability to all missing methods?


Source: StringBuilder Class in Java
 
Last edited:
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top