Does this assume the number is always negative b/c that isn't always the
case?  The number could be positive or negative.  I found this on the
MSDN site, but can't make any sense out of it.

 

 

namespace Green  

{  

    using System.Text.RegularExpressions;  

  

    class Grass  

    {  

        public static void Main()  

        {  

            string input =
@"D,0063840001002,N,0000000490,0000000490,0000000200-,0000000091-,200807
13,0297";  

            string result=Regex.Replace(input,
@"(?<=^|,)(\d+)(-)(?=,|$)", @"$2$1");  

            Console.WriteLine(result);  

        }  

    }  

}  

//  Output:  

//  

//
D,0063840001002,N,0000000490,0000000490,-0000000200,-0000000091,20080713
,0297  

//  

//  Done.  

 

 

http://social.msdn.microsoft.com/forums/en-US/csharpgeneral/thread/bce76
bce-ce90-4bae-8d13-4a00a36d8d50

 

 

Thanks,

 

Reese

 

Reese E. Walker
Lead Financial Systems Analyst
Manager, Phoebe Cares Dept.
Phoebe Putney Memorial Hospital
Phone: (229) 312-4259

________________________________

From: [email protected] [mailto:[email protected]] 
Sent: Thursday, March 19, 2009 11:27 AM
To: [email protected]
Subject: [talkbws] RE: String Function

 

A quick and dirty way would be this

 

Dim x
    
    If InStr("99.99-", "-") > 0 Then
       x = Mid("99.99-", 1, Len("99.99-") - 1)
    
        x = x * -1
        
        
        
    End If
    

 

 

 

John Burdek

Programmer Analyst

Saint Clare's Health System

66 Ford Road

Denville, NJ 07834

Phone: (973) 983-1532

Pager: (973) 259-2721

Fax: (973) 983-1530

[email protected] <mailto:[email protected]> 

 

         

        
________________________________


        From: [email protected] [mailto:[email protected]] 
        Sent: Thursday, March 19, 2009 11:18 AM
        To: [email protected]
        Subject: [talkbws] String Function

        I am viewing a string on my screen and b/c STAR is stupid a
negative number shows up as 99.99-.  Well excel doesn't like that, so I
need a function that will move the negative to the front of the number
if it is present.  Can anyone help with this?  I know how to replace a
character; I just don't know how to move it.  I thought about just
viewing that last character separately and always putting it on front,
but it is left justified on the screen and I never know how many numbers
are going to be in front of it ahead of time.  Any help is greatly
appreciated.

         

        Thanks,

         

        Reese

         

        Reese E. Walker
        Lead Financial Systems Analyst
        Manager, Phoebe Cares Dept.
        Phoebe Putney Memorial Hospital
        Albany, GA. 31702
        Phone: (229) 312-4259
        Pager: (229) 431-7658
        Fax: (229) 312-4316

         

        
________________________________


         

        
        Disclaimer:
        The HIPAA Final Privacy Rule requires covered entities to
safeguard
        certain Protected Health Information (PHI) related to a person's
        healthcare. Information being faxed to you may include PHI after
        appropriate authorization from the patient or under
circumstances
        that do not require patient authorization. You, the recipient,
are
        obligated to maintain PHI in a safe and secure manner. You may
not
        re-disclose without additional patient consent or as required by
        law. Unauthorized re-disclosure or failure to safeguard PHI
could
        subject you to penalties described in federal (HIPAA) and state
        law. If you the reader of this message are not the intended
        recipient, or the employee or agent responsible to deliver it to
        the intended recipient, please notify us immediately and destroy
        the related message.

        --- 
        To post a message to this list, send mail to: [email protected] 
        
        You are currently subscribed as: [email protected] 
        
        Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 

 
---





To post a message to this list, send mail to: [email protected]





 





You are currently subscribed as: [email protected]





 





Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 





 
        
        DISCLAIMER: Saint Clare's Health System Confidentiality Notice:
This e-mail and any accompanying documents may be confidential and/or
legally privileged. If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or the taking
of any action in reliance on the contents of this information is
strictly prohibited. If you have received this e-mail in error, please
notify the sender immediately by reply e-mail and delete the message and
any attachments. Thank you.              
--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [email protected] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 


--- 
To post a message to this list, send mail to: [email protected] 

You are currently subscribed as: [email protected] 

Unsubscribe in the customer center on our website:
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk
.aspx 



---
To post a message to this list, send mail to: [email protected]

You are currently subscribed as: [email protected]

Unsubscribe in the customer center on our website: 
http://www.bostonworkstation.com/customer_center/virtual_user_group_talk.aspx

Reply via email to