Trim not removing white spaces? - string

I have a field with hex a decimal values that look like FF FE, I need to remove the white space so the results are FFFE but trim is not working for me! Is there another function I can use?

Trim only removes whitespace at the beginning and end. Use substitute instead.
=SUBSTITUTE({cell ref}," ","")
should do the trick

Related

How to add trailing spaces or blanks in the report

Apparently the report seems to explicitly trimming any trailing spaces on report fields. But I need those spaces because it's a bank feed. I got an expression something like :
=PadRight( [BAccount.AcctName] , 50, ' ' )
or
=' BLAH '
Still no spaces
Does anyone has any tricks to achieve it ?
TIA
I believe the report engine will trim all whitespace and non-printable characters.
Does anyone has any tricks to achieve it ?
Yes, based on assumption above; one possible trick is to append a printable Unicode character at the end of the string that renders as whitespace but isn't technically considered white space. This type of trick is very common in phishing attacks.
I choose the 'Braille Pattern Blank' character which renders like a space character but isn't considered whitespace.
Reference:
https://www.compart.com/en/unicode/U+2800
You can copy it directly from character box in link above (highlighted blue):
And paste it in Acumatica report designer to append it after the blank space:
I tested this by selecting the field in report, it appended the desired spaces:

Remove white space from string using vba

I have a string:
result = " is programming that manages the execution of programs written in any of several supported languages."
I want to remove white space at the beginning of a sentence.
How I can do it?
You can do this by using Trim(String) in VBA (for trimming left and right spaces) or use LTrim(String) for only trimming leading spaces.
You can use Trim(result) it will remove all white spaces at the beginning and at the end of a string

Keeping leading zeros with find and replace

I'm using Excels find and replace to remove hyphens from long numbers. They are mixed between birth dates and organisation numbers that have been filled with leading zeros to have the same number of characters. There are a LOT of numbers so find and replace seems to be the simplest solution to remove the hyphens.
But when i use find and replace the leading zeros are truncated and I have not found a solution to keep them afterwards.
For example i have:
19551230-1234
01234567-8901
and after find and replace I have
1,95512E+11
12345678901
but want the format as:
195512301234
012345678901
So I want to keep the leading zeros after find and replace. I've tried formatting the cells as text, but it doesn't work as the find and replace automatically truncates the leading zero and keeps the remaining characters, so the zero is completely removed. I am using Excel 2010, but answers for several versions are appreciated.
Just put a single quote in front of your leading number - ex. '01234 It will take the number as-is literally and the quote will not show in the field.
Use the SUBSTITUTE formula instead of Find and Replace like so:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1," ",""),"/",""),")",""),"(",""),"-","")
The result is text.

cant remove whitespaces from hexadecimal string EXCEL

I have an excel file with one column with hexadecimal values in this format: 00 00 00 and I want to change them into decimal values so I tried using REPLACE to remove white spaces:
=REPLACE(A1," ", , "")
but what I got was #VALUE!
Why is that?
If you want to convert from hexadecimal to decimal, merely removing white space from a certain format won't do that. Use the function HEX2DEC() instead. To apply it, you do need to remove the spaces:
=HEX2DEC(SUBSTITUTE(A1, " ",""))
I used =HEX2DEC(SUBSTITUTE(A1," ","")) and that worked, so I guess SUBSTITUTE works better here than REPLACE

How to replace the white blanks with four in vim?

There are 5 white blanks in line 3,6 white blanks in line 4,7 white blanks in line 5.
I want to replace them with 4 white blanks,how to write the command?
It is not %3,7s/^\s*/ /g ,how to fix it?
it is a test
it is a test
it is a test
I want change it into:
it is a test
it is a test
it is a test
Based on your example, it sounds like you want to replace all sequences of whitespace at the beginning of lines with 4 spaces.
Please comment if I have misinterpreted your question. You can do this by looking for an arbitrary amount of whitespace at the beginning of line and replacing with four spaces.
%s/^\s\+/ /g
You typed :%3,7s/^\s*/ /g, but % is a range and 3,7 is another range, so it's wrong : you have to choose between them:
:%s ...
will replace in the whole file, or
:3,7s ...
will only replace in lines from 3 to 7.

Resources