TRIM Spaces from Text as a Command or Expression?
Is there some sort of command or expression that can trim text from either end of a text string, please?
I assumed there was one, but upon searching, oddly I cannot find one or it does not exist.
OPAT
Would you please give us a sample what you are looking for, thanks.
@Aleksi_Alkio For example:
"
The quick brown fox jumps over the lazy dog.
"
becomes
โThe quick brown fox jumps over the lazy dog.โ
Is the start and end โstringโ always the same like four spaces?
@Aleksi_Alkio No, it could be many or a few.
Are these values coming from a different service?
I am something that behaves like these functions ideally:
docs.microsoft.com - LTrim, RTrim, and Trim functions | Microsoft Docs
and this:
https://www.tutorialspoint.com/java/java_string_trim.htm LTrim, RTrim, and Trim functions | Microsoft Docs docs.microsoft.com
We should have a Trim function! Will get it in next week.
Actually, it will be on Monday! :]
@praveen Wow! A new Function in just 7 minutes! It must be an Appsheet record! Thanks!
Hopefully, it might address a minor cosmetic anomaly I encountered yesterday.
Okayโฆ I gave up. You can of course create that filter with existing expressions, but it would be quite complex. Praveenโs solution is much quicker
You can trim spaces from a text using trim() method of String class.
public class StringTrimJava
{
public static void main(String[] args)
{
String str = " welcome to helloworld java! ";
System.out.println(str);
System.out.println(str.trim());
}
}
Output:
welcome to helloworld java!
User | Count |
---|---|
44 | |
29 | |
22 | |
20 | |
14 |