Tapatalk

Formating numbers

Formating numbers

2
NewbieNewbie
2

    Jul 26, 2006#1

    I am a complete novice in the use of UltraEdit 32 and I'm in need of some assistance. I am editing files which contain columns of figures running into tens of Millions of Pounds. The numbers are quite difficult to read without seperation, is it possible to format the numbers to include thousand seperators, i.e ten million would display as 10,000,000.00. Many thanks in advance. Iain

    6,685587
    Grand MasterGrand Master
    6,685587

      Jul 27, 2006#2

      One solution is to use a macro with several regular expression search and replaces. Enable the macro property Continue if a Find with Replace not found for this macro!

      The first macro is with UltraEdit style regular expressions.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      Find RegExp "^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2,^3"
      Find RegExp "^([0-9][0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2,^3"
      Find RegExp "^([0-9]^)^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2,^3"
      Find RegExp "^([0-9][0-9][0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2"
      Find RegExp "^([0-9][0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2"
      Find RegExp "^([0-9]^)^([0-9][0-9][0-9]^)"
      Replace All "^1,^2"

      The same macro with Unix or Perl regular expressions, if you prefer one of these regular expression engines.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Top
      Find RegExp "(\d\d\d)(\d\d\d)(\d\d\d)"
      Replace All "\1,\2,\3"
      Find RegExp "(\d\d)(\d\d\d)(\d\d\d)"
      Replace All "\1,\2,\3"
      Find RegExp "(\d)(\d\d\d)(\d\d\d)"
      Replace All "\1,\2,\3"
      Find RegExp "(\d\d\d)(\d\d\d)"
      Replace All "\1,\2"
      Find RegExp "(\d\d)(\d\d\d)"
      Replace All "\1,\2"
      Find RegExp "(\d)(\d\d\d)"
      Replace All "\1,\2"

      An explanation about Regular Expressions and the meanings of the sequences above can be found in help of UltraEdit. If you have numbers larger 999,999,999 you have to add additional find/replaces at top of the macro after the command Top. It should be clear how these replaces must be defined and in which sequence.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Jul 27, 2006#3

        Mofi, many thanks. The solution looks obvious when you see it in print, but I struggled with this for many hours without making any progress. Now I need to work out how to delete a character before the number string for each character inserted to maintain the right justification of the column figures.

        Again many thanks for your help

        Iain.