﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » mask to insert spaces before text?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 00:17:32 GMT</lastBuildDate><ttl>20</ttl><item><title>mask to insert spaces before text?</title><link>http://forum.strataframe.net/FindPost16583.aspx</link><description>I have certain codes (example: customer code) that can have numbers  or alphanumerical characters example "AB123" or "123" or "123AB"&lt;br&gt;
&lt;br&gt;
If I save some customer codes  like "1" "2" and "11", when I try to order by this field the "11" will be on 2nd place&lt;br&gt;
&lt;br&gt;
1,&lt;br&gt;
11&lt;br&gt;
2&lt;br&gt;
&lt;br&gt;
only if I put a space before the number will be orderer ok ( " 1", " 2", "11")&lt;br&gt;
&lt;br&gt;
 1&lt;br&gt;
 2&lt;br&gt;
11&lt;br&gt;
&lt;br&gt;
what do you recommend to do ? can I only add spaces when I like to persist the code that a user enter on the field to the DB to order it correctly? how is the best to do this?&lt;br&gt;
Thanks for any suggestion.</description><pubDate>Mon, 26 May 2008 14:17:16 GMT</pubDate><dc:creator>Fabian R Silva, -</dc:creator></item><item><title>RE: mask to insert spaces before text?</title><link>http://forum.strataframe.net/FindPost16596.aspx</link><description>You can case it as Edhy mentioned, or perform the query and pad the results in the off chance that you have an illegal integer value which would then result in an error.&amp;nbsp; So I would probably just create a query that brings the data back with the padding versus trying to manage this within the BO itself.&amp;nbsp; This would also be the fastest in regards to performance.</description><pubDate>Mon, 26 May 2008 14:17:16 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: mask to insert spaces before text?</title><link>http://forum.strataframe.net/FindPost16595.aspx</link><description>Hi Fabian,&lt;/P&gt;&lt;P&gt;I have done that but in VFP.&amp;nbsp; What I did was to convert or cast the field to integer so it will sort the way I needed to.&amp;nbsp; I think you may do something like that to get the proper sorting by casting the field, but keep in mind that when you cast values like ABC will have no meaning, only the digits will be casted.</description><pubDate>Mon, 26 May 2008 14:05:36 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>