MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Use what to remove spaces from the beginning and end of the string value?
A
TRIM
B
CROP
C
NOSPACE
D
SPACE
Explanation: 

Detailed explanation-1: -The trim() method removes whitespace from both ends of a string and returns a new string, without modifying the original string. To return a new string with whitespace trimmed from just one end, use trimStart() or trimEnd() .

Detailed explanation-2: -Use the .strip() method to remove whitespace and characters from the beginning and the end of a string. Use the .lstrip() method to remove whitespace and characters only from the beginning of a string.

Detailed explanation-3: -To remove leading and trailing spaces in Java, use the trim() method. This method returns a copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.

Detailed explanation-4: -Removing All Whitespace From a String replaceAll() works with regular expressions (regex). We can use the regex character class ‘’ to match a whitespace character. We can replace each whitespace character in the input string with an empty string to solve the problem: inputString. replaceAll(“

There is 1 question to complete.