Java Tutorials: StringBuilder Class Methods (length(), reverse(), setLength(), setCharAt(index), subString(), replace())

in #utopian-io7 years ago (edited)

In this tutorial, you will learn the following:

  • StringBuilder Methods:
    • length()
    • reverse()
    • setLength()
    • setCharAt(index)
    • subString()
    • replace()

You would need the following inorder to following this tutorial:

  • An Integrated Development Environment(IDE) installed that can run Java (e.g Eclipse, IntelliJ,Netbeans)
  • JDK 1.X installed on your Pc
  • Of course willingness to learn

Difficulty

  • Intermediate

Description

In this tutorial, we take a look at the StringBuilder class.
Strings are immutable meaning they cant e destroyed once created, but a StringBuilder is mutably making it the best option for string manipulation.
The following are a few methods amongst many:

length(): This method returns the length of the StringBuilder object which is the total number of characters.

subString(index): This returns a substring of the StringBuilder object starting from the index specified to the end of the StringBuilder object which is the total length of the StringBuilder object.

setCharAt(index): This changes the character at the specified index.

Video Tutorial Link:

NB: This video has only being shared on my Youtube Channel

Tutorial codes can be gotten from this github repository: https://github.com/generalkolo/Javacodes



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • Your contribution has been rejected due to having the logo at the bottom of the page. Please delete it and do not re-post this contribution again. Kind Regards.

You can contact us on Discord.
[utopian-moderator]

@ewq i never got any warning about the logo below.
I would delete it but i believe that i should have been warned first before my contribution was rejected!
Thanks.

Hey @ewq, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

@edetebenezer, Contribution to open source project, I like you and upvote.

Thank you for the contribution. It has been approved.

  • It is your responsibility to read our rules carefully sir. It would also be nice to have your intro removed at the beginning of the video. Kind Regards.

You can contact us on Discord.
[utopian-moderator]

Thanks, @ewq.
Would remove the intro also!

Nice one bro. You got great skills

Hey @edetebenezer I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 60701.29
ETH 2637.06
USDT 1.00
SBD 2.52