Lesson 23 of 34
StringBuilder: வேகமாக String உருவாக்குதல்StringBuilder: Building Strings Fast
8 min 30 XP
String immutable என்பதால் loop-ல் += செய்தால் ஒவ்வொரு முறையும் புதிய String உருவாகும், மெதுவாக இருக்கும். StringBuilder மாற்றக்கூடியது, வேகமானது.
Because Strings are immutable, += in a loop creates a new String every time, which is slow. StringBuilder is mutable and fast. String vs StringBuilder is a common interview question.
Example: edit me and press Run
Press Run to see the result here.split() ஒரு String-ஐ பிரித்து String array தரும். String.join() மீண்டும் இணைக்கும்.
split() breaks a String into a String array and String.join() puts pieces back together.
Example: edit me and press Run
Press Run to see the result here.