• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can we assign a text in front text.

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

normally we can add any string through concat behind the text
but my question is how can we add any string in front of the text?
like i need an out put like this "break Helloworld"
please any one give me an answer.
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you find any method in the String API? You should try to make your own method.
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String objects are immutable i.e. they are not meant to be modified in the way you want. This is why there are StringBuffer and StringBuilder classes...
 
Dhanushanth Dhanu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:Did you find any method in the String API? You should try to make your own method.


no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()
 
Dhanushanth Dhanu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:String objects are immutable i.e. they are not meant to be modified in the way you want. This is why there are StringBuffer and StringBuilder classes...


Yes sir i know that string objects are immutable.so can we do that with StringBuffer or StringBuilder classes? i mean that what i asked above
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dhanushanth Dhanu wrote:no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()


cancat() isn't a keyword, it's a method of String class. And have a look on this method of StringBuffer class
 
Dhanushanth Dhanu
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:

Dhanushanth Dhanu wrote:no sir i didn't see any method for that but what I'm asking is do we have any keyword for that like concat()


cancat() isn't a keyword, it's a method of String class. And have a look on this method of StringBuffer class



thank you sir.
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For god's sake don't call me sir
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dhanushanth Dhanu wrote:
normally we can add any string through concat behind the text
but my question is how can we add any string in front of the text?
like i need an out put like this "break Helloworld"
please any one give me an answer.



Did you try with

?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:For god's sake don't call me sir


I repeat it!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic