Small snippets on how you can transform list to a string.
Disclaimer : All the assets used as background belongs to respective companies I don't promote them as my own, they are just used to make code relatable and attractive.
List to string conversion is very useful in competitive programming these days, here I showcase
joinToString() function and various operation that can be performed with it. Now then 👁️ on the code 💻👇
List to String?
Convert a list to string using join function.
List to String with Separator?
How to provide custom gluing symbol instead of
List to String with Start and End symbol ?
How to add start (prefix) and end (suffix) to the string. Prefix and Suffix will not be affected by separator or any transformation(discussed later) performed while undergoing the operation.
List to String with truncating after certain limit ?
I want to show
... if text is very long.
List to String with custom truncate symbol ?
Can I provide anything else than
List to String with some transformation per step ?
How to perform action/transformation per string concatenation..
That's all fokes! , these are the basic operations that can be performed on the
join function and are always handy to know! see ya in next snippet 💻 Happy Hacking!
Enjoy the article?
a clap is much appreciated if you enjoyed. No sign up or cost associated :)
P.S Oh.. before I forget! List is supported only because its
Iterable, discover more about it on official docs :