2007-11-08

Notes: When a space is not a space

Symptoms:

A field that receives numbers (either is a number field or is a text field that receives input from a number field on a dialog box), contains spaces (ex: 1 000 or 27 000) that can't be removed with a @ReplaceSubstring(field_name; " "; "").




Cause:


The number field has the "Punctuated at thousand" option set, which, in some user settings, causes the insertion of a space within the number. But this space is not the common ASCII character 32, but a special one: the ASCII character 160.






Solution:


Use this code:


sSpace1:=@char(32);
sSpace2:=@char(160);
sNumber:=@ReplaceSubstring(field_name; sSpace1; "");
sNumber:=@ReplaceSubstring(sNumber; sSpace2; "");