help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to see the value of each char in a string?


From: David Combs
Subject: Re: How to see the value of each char in a string?
Date: Wed, 27 Nov 2002 18:50:31 +0000 (UTC)

In article <ur8d7crj3.fsf@ID-87814.user.dfncis.de>,
Oliver Scholz  <alkibiades@gmx.de> wrote:
>dkcombs@panix.com (David Combs) writes:
>[...]
>> The real question is: how to find the value of each
>> char in a string.
>>
>> Is there a function that already does that?
>>
>> Maybe someone can show me the two or three lines
>> of elisp code to show the string with, for each char,
>> its numerical value (er, index, I guess).
>>
>> Like, for "foo":
>>  
>> f 146
>> o 157
>> o 157
>[...]
>
>(mapcar 'identity "foo")
>
>    Oliver

Cool -- and the last thing I would have ever thought of.

Now, for elisp-lesson #2, how to add to that the 
non-numerical representation, eg:

(146   157   157   )
(146 157 157)
("f" "o" "o")

Like, for "foo123foo":

 (146 157 157 061 063 146 157 157)
 ("f" "o" "o" "2" "3" "f" "o" "o")



, or, if fill-column happens to be 20:


 (146 157 157 061 
 ("f" "o" "o" "2" 

063 146 157 157)
"3" "f" "o" "o")

Like, maybe running through the string twice, each
time saving the result, and while generating each one,
inserting three newlines every so often,

Perhaps, if a char is messy to print, eg ^L, then
something without quotes, eg "^L" (but no quotes, so
it fits).

----

Even a skeleton would be a big help; then maybe others
would add suggestions, etc.  Fun.

-------------------------------------------------------
-------------------------------------------------------

Here's the reason for my question: figuring out this (taken 
from *shell*):


   20 ==/dkcjunk/pstree-19.3==> ls /tfile11--myexternals-opt
   


What in the world caused all those ^G's?

Here's the dired-listing of that dir:

  /opt6/tfile11--myexternals-opt:
  total 28
  drwxr-xr-x  10 root     other        512 Nov  8 03:50 .
  drwxr-xr-x  15 root     root         512 Nov  8 22:51 ..
  drwxr-xr-x   2 dkc      other        512 Mar 15  2002 Acrobat3.2
  drwxrwxr-x   3 root     bin          512 Jan 11  1996 appconfig
  drwxrwxr-x   2 root     bin          512 Jan 12  1996 bin
  lrwxrwxrwx   1 root     other         16 Nov  8 03:50 examples -> 
./share/examples
  drwxrwxrwx  42 root     other       2048 Jul 18  2001 gnu
  lrwxrwxrwx   1 root     other         15 Nov  8 03:50 include -> 
./share/include
  drwxrwxr-x   4 root     bin          512 Jan 12  1996 lib
  drwx------   2 root     root         512 Aug 16  1995 lost+found
  lrwxrwxrwx   1 root     other         11 Nov  8 03:50 man -> ./share/man
  drwxr-xr-x   3 root     other        512 Apr  8  1996 opt
  drwxr-xr-x   3 root     other        512 Apr  8  1996 var


Looks ok to me.

(Heck, any ideas on *this* problem?)

Oh, here I do the ls from a dttool:

16 ==/home/dkc==> j
17 ==/home/dkc==> ls  /opt6/tfile11--myexternals-op
/opt6/tfile11--myexternals-op: No such file or directory
18 ==/home/dkc==> 


, and I copy/pasted the dirname from the top of
the dired-buf.


Thanks,

David (confused)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]