Padding zeros in map-How to?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server > Padding zeros in map-How to?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Padding zeros in map-How to?  
Gurvinder


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-10-07 06:18 PM

Hi All,

I have cost value and it comes as 12345 and i want to make it 123.45 and i
am able to do that. But if value come like 12 or only 1 then i have to pad
zero before it if i want to insert .(dot) before last 2 numbers for ex
if I get 1 and i want it to look .01 how can i do that in map. may be
cheking lenght of in comming string/number and padding zero before it I dont
know how to pad '0'

Any help appriciated.

Thanks,
Gurvinder





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Jan Eliasen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-11-07 12:18 AM

On Fri, 10 Aug 2007 07:10:06 -0700, Gurvinder
<Gurvinder@discussions.microsoft.com> wrote:

>I have cost value and it comes as 12345 and i want to make it 123.45 and i
>am able to do that. But if value come like 12 or only 1 then i have to pad
>zero before it if i want to insert .(dot) before last 2 numbers for ex
>if I get 1 and i want it to look .01 how can i do that in map. may be
>cheking lenght of in comming string/number and padding zero before it I don
t
>know how to pad '0'
Have a custom scripting functoid that is a C# script, and have this
code:
public void pad(string param)
{
string str = param.PadLeft(5, '0');
str = str.Insert(3, ".");
MessageBox.Show(str);
}

Maybe it needs more code... do you want 000.01 or just .01 ?

--
eliasen, representing himself and not the company he works for.

Private blog: http://blog.eliasen.dk

Private email: jan@eliasen.dk





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Gurvinder


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-13-07 06:19 PM

i want .01

pls help


"Jan Eliasen" wrote:

> On Fri, 10 Aug 2007 07:10:06 -0700, Gurvinder
> <Gurvinder@discussions.microsoft.com> wrote:
> 
> Have a custom scripting functoid that is a C# script, and have this
> code:
> public void pad(string param)
> {
>     string str = param.PadLeft(5, '0');
>     str = str.Insert(3, ".");
>     MessageBox.Show(str);
> }
>
> Maybe it needs more code... do you want 000.01 or just .01 ?
>
> --
> eliasen, representing himself and not the company he works for.
>
> Private blog: http://blog.eliasen.dk
>
> Private email: jan@eliasen.dk
>





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Jan Eliasen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-14-07 06:18 AM

On Mon, 13 Aug 2007 07:56:03 -0700, Gurvinder
<Gurvinder@discussions.microsoft.com> wrote:

>i want .01
Replace the code with this:

string str = this.padTextBox.Text.PadLeft(5, '0');
str = str.Insert(3, ".");
str = str.TrimStart('0');

--
eliasen, representing himself and not the company he works for.

Private blog: http://blog.eliasen.dk

Private email: jan@eliasen.dk





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Gurvinder


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-16-07 12:17 AM

other way i can think of doing is divide by 100 and in database use precisio
n
up to 2 places (if 0/100 type)

"Jan Eliasen" wrote:

> On Mon, 13 Aug 2007 07:56:03 -0700, Gurvinder
> <Gurvinder@discussions.microsoft.com> wrote:
> 
> Replace the code with this:
>
> string str = this.padTextBox.Text.PadLeft(5, '0');
> str = str.Insert(3, ".");
> str = str.TrimStart('0');
>
> --
> eliasen, representing himself and not the company he works for.
>
> Private blog: http://blog.eliasen.dk
>
> Private email: jan@eliasen.dk
>





[ Post a follow-up to this message ]



    RE: Padding zeros in map-How to?  
Gurvinder


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-16-07 12:17 AM

but if i have to add/padd zeros then your approach is best to it

"Gurvinder" wrote:

> Hi All,
>
> I have cost value and it comes as 12345 and i want to make it 123.45 and i
> am able to do that. But if value come like 12 or only 1 then i have to pad
> zero before it if i want to insert .(dot) before last 2 numbers for ex
> if I get 1 and i want it to look .01 how can i do that in map. may be
> cheking lenght of in comming string/number and padding zero before it I do
nt
> know how to pad '0'
>
> Any help appriciated.
>
> Thanks,
> Gurvinder





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Jan Eliasen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-16-07 12:17 AM

On Wed, 15 Aug 2007 11:44:06 -0700, Gurvinder
<Gurvinder@discussions.microsoft.com> wrote:

>other way i can think of doing is divide by 100 and in database use precisi
on
>up to 2 places (if 0/100 type)
That will probably work as well.

--
eliasen, representing himself and not the company he works for.

Private blog: http://blog.eliasen.dk

Private email: jan@eliasen.dk





[ Post a follow-up to this message ]



    Re: Padding zeros in map-How to?  
Jan Eliasen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-16-07 12:17 AM

On Wed, 15 Aug 2007 11:44:06 -0700, Gurvinder
<Gurvinder@discussions.microsoft.com> wrote:

>other way i can think of doing is divide by 100 and in database use precisi
on
>up to 2 places (if 0/100 type)
.. but I probably wouldn't go that way - I would use my suggestion. I
wouldn't change the database layout for that... what is it is changed
back at some point? If another develoepr doesn't want the restriction
in the database, or the database is overwriten by a Service Pack for
the sytem or something like that... With my solution, it will work at
all times.

--
eliasen, representing himself and not the company he works for.

Private blog: http://blog.eliasen.dk

Private email: jan@eliasen.dk





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:17 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register