Trim() Vs Strip() in Java 11 Example Program

Table of Contents
Trim():
- Removes whitespace for unicodes which are less than or equal to \u0020
Strip():
- Removes whitespace which are even greater than \u0020
Trim() Strip() – Java 11 Sample Program:
package com.ngdeveloper.java11;
public class TrimVsStrip {
public static void main(String[] args) {
String s1 = " Mirthbees ";
System.out.println("trim() : "+s1.trim());
System.out.println("strip() : "+s1.strip());
String s2 = "\t 1site \n";
System.out.println("trim() : "+s2.trim());
System.out.println("strip() : "+s2.strip());
String s3 = "\\u2000 NgDev \\u2000";
System.out.println("trim() : "+s3.trim());
System.out.println("strip() : "+s3.strip());
Character c = '\u2000';
String cs = c + "Saveji" + c;
System.out.println("trim() : "+cs.trim());
System.out.println("strip() : "+cs.strip());
}
}
Trim() Strip() – Java 11 Sample Program Output:
trim() : Mirthbees strip() : Mirthbees trim() : 1site strip() : 1site trim() : \u2000 NgDev \u2000 strip() : \u2000 NgDev \u2000 trim() : ?Saveji? strip() : Saveji
What is unicode ?
Numbers, mathematical notation, popular symbols and characters from all languages are assigned a code point, for example, U+0041 is an English letter “A.” Below is an example of how “Computer Hope” would be written in English Unicode. A common type of Unicode is UTF-8, which utilizes 8-bit character encoding.
Yo gamers, peraplaygaming is killin’ it with the variety of games. Something for everyone, whether you’re into slots or something more strategic. Check ’em out! peraplaygaming
The atmosphere here is just different, feels like a real casino from my living room. Super satisfied with cg777casino.
Super impressed with the security features here. I feel safe depositing my funds and the games are incredibly addictive. tg77722login is the way to go.