Trimming:
- You can remove in String Whitespace in to use function trim() ,
Right side to remove String Whitespace in to use function trimRight() ,
Left Side to remove String white space in to use function trimLeft() .
void main(){
String str = " Hello Jeet How are You! ";
print(str.trim());
print(str.trimLeft());
print(str.trimRight());
}
Output:
Hello Jeet How are You!
Hello Jeet How are You!
Hello Jeet How are You!
Padding:
- You can add Padding space in Your String sentence in padding add using padLeft() and padRight() function to use padding set in Your string sentence
void main()
{
String str1 = "Jeet";
print(str1.padLeft(10,'--'));
print(str1.padRight(3));
}
Output:
----------Jeet
Jeet