Dear Team;
How can i remove Tab Space from the text.
I am using bar code scanner to scan bar during interview.
Best regards.
a.
Remove Tab space
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Remove Tab space
I would write a user-defined function to handle this. I wrote a naive example that removes spaces to give you the general idea. As I loop through the string I ignore any space, but copy all other characters. After the function has run my new string will have no spaces.
function string removeSpaces(string strIn)
string strOut;
numeric len = length(strIn);
numeric j = 1;
do numeric i = 1 while i <= len
if strIn[i:1] <> " " then
strOut[j:1] = strIn[i:1];
inc(j);
endif;
enddo;
removeSpaces = strOut;
end;
string strOut;
numeric len = length(strIn);
numeric j = 1;
do numeric i = 1 while i <= len
if strIn[i:1] <> " " then
strOut[j:1] = strIn[i:1];
inc(j);
endif;
enddo;
removeSpaces = strOut;
end;
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Remove Tab space
Dear;
Thank you for the reply.
I don't want to remove this space because based on these spaces i am extracting text.
The other thing is, this is not a simple space, it is a tab space.
Thanks.
a.
Thank you for the reply.
I don't want to remove this space because based on these spaces i am extracting text.
The other thing is, this is not a simple space, it is a tab space.
Thanks.
a.
Re: Remove Tab space
It is not possible to enter a tab character in CSEntry. Tab moves you to the next field.
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Remove Tab space
Dear Josh
Actually i am using a bar code scanner from the play store to scan Bar on my tablet.
When i scan and past the text and press next to extract text based on the space it does not work because this space is tab ( i think so).
When i remove this space and give the space manually then it works.
So my question is, how can i replace this space with actual space.
Best regards.
a.
Actually i am using a bar code scanner from the play store to scan Bar on my tablet.
When i scan and past the text and press next to extract text based on the space it does not work because this space is tab ( i think so).
When i remove this space and give the space manually then it works.
So my question is, how can i replace this space with actual space.
Best regards.
a.
Re: Remove Tab space
You are right, you can enter a tab character by pasting. You should be able to check for a tab character in logic by testing if a character is equal to " " (in case it doesn't look correct on the forum, that is a double quote followed by hitting the tab key followed by another double quote). To replace the tab with a space you would do something like the following:
do numeric i = 1 while i <= length(MYFIELD)
if MYFIELD[i:1] = " " then
MYFIELD[i:1] = " ";
endif;
enddo;
Note that in the if condition it is a tab character (" + tab + ") and not a space but in the assignment statement below it is a space.if MYFIELD[i:1] = " " then
MYFIELD[i:1] = " ";
endif;
enddo;