Loading ...
Sorry, an error occurred while loading the content.

Re: How to avoid number to string auto conversion?

Expand Messages
  • Sean
    ... Thanks John, it already worked using printf( %04o ,myvariable)= 0010 What I have is 0010 in the data file. What I want is 0010 in the list and during
    Message 1 of 6 , Jan 10, 2009
    • 0 Attachment
      On Jan 10, 11:07 pm, "John Beckett" <johnb.beck...@...> wrote:
      > Sean wrote:
      > > let myvariable = 0010
      > > printf('%04d',myvariable)='0008'
      > > printf('%04o',myvariable)='0010'
      >
      > > The last is what I really want!
      >
      > > The data are from a data file like:
      > > 0000 AAAA
      > > 0000 AAAB
      > > 0010 BBBB
      >
      > > The number is <key>, the <value> is multi-byte, and it is one
      > > to many mapping.
      >
      > I don't see why you would want octal. If you like, post a little more
      > sample code to show what you actually want to do. Are you trying to read
      > the data file (as above), and put the data into a structure? How about a
      > dictionary of lists? Where does the octal come in?
      >
      > When you look up the data, what is the input, and what is the wanted
      > output? For example:
      >
      >  let mykey = 0  " the 0000 above
      >  let mylist = Lookup(mykey)  " list ['AAAA', 'AAAB']
      >
      > John


      Thanks John, it already worked using
      printf('%04o',myvariable)='0010'

      What I have is 0010 in the data file.
      What I want is '0010' in the list and during conversion.
      The printf() you pointed out worked!


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.