chr() is a function in Python or PHP which returns the character (string of length one) that corresponds to an ASCII code point.
Questions tagged [chr]
166 questions
1
vote
1 answer
Need to print out the Python3 Character Map (asc:32 - 127)
I need to write a program that prints out the chr lines from the table below (including 32 and 127 which is just whitespace). I was able to successfully print all the chr from the table but it prints each character on separate lines. It keeps coming…

Tiffany
- 21
- 3
1
vote
1 answer
Oracle chr() diferent returns from SQL engine versus PL/SQL engine, why?
Same function, same argument, different outputs:
set serveroutput on;
declare
n number := 122.5;
c_plsql varchar2(1);
c_sql varchar2(1);
begin
c_plsql := chr(n);
select chr(n) into c_sql from dual;
…

user8952391
- 13
- 5
1
vote
1 answer
R change chr to dttm and dateTime format
Have been trying for days to convert a chr column in the format of dd/mm/yyyy HH:MM into dttm in the format of yyyy-mm-dd HH:MM:SS.
nothing works and I keep getting NA as the output as it "failed to pharse"
started with
$ started_at …

BenZenoVKa
- 53
- 5
1
vote
4 answers
chr(n) failed when n exceeds 256
I am using chr and int to convert a binary representation string to real binary value.
What I did is
n=int('0101011',2)
binary=chr(n)
Then binary is the real binary value of the representation string.
But what if the string I gave to int is…

xiaohan2012
- 9,870
- 23
- 67
- 101
1
vote
1 answer
Simple I am sure: Printing 2 columns with header and results -- new to python
I am new to python and did not see this exact questions or answers that will work. I am using Python 3.7 and simply need to display the character codes for uppercase alphabet letters (A-Z). I have that part, but it also requires the output be…

Ken
- 13
- 2
1
vote
1 answer
different results when I encode a character to base64
When I encode a character to base64, I get different results depending on the the way I pass the character:
For example, I want to encode chr(128) => €
1.passing the result of chr(): base64_encode(chr(128)) => 'gA=='
2.passing the character…

남현우
- 23
- 4
1
vote
0 answers
CHR: managing "constraint stores"
Is there a way to manage Constraint stores in CHR ?
What I have in mind ?
Let say I do a query. I want the result set, set aside (may be with different scope than user:) for reuse OR as start for a different run, OR just for inspection.
Another…

sten
- 7,028
- 9
- 41
- 63
1
vote
1 answer
Python Encoding Problems using ASCII Code
Write a function
shiftLetter(letter, n)
whose parameter, letter should be a single character. If the character is between "A" and "Z", the function returns an upper case character
n
positions further along, and "wrapping" if the +
n
mapping…

hursooo
- 43
- 5
1
vote
0 answers
Escape 0x1b;t;0x7 command code For printer
How I can translate following working VisualBasic code to Python?
print #1,Chr$(&H1B) & "t" & Chr$(7)(running on Windows)
I tried this (for Ubuntu):
kkm_port = open(stg.kkm_port,"a")
print >> kkm_port,chr(0x1B)
print >> kkm_port,"t"
…

mic
- 11
- 1
1
vote
3 answers
Is it Possible to convert a set of numbers to their ASCII Char values?
I can convert a string into the Ascii values with spaces in between.
Example: "I like carrots"
To: 73 32 108 105...
But I'm trying to figure out a way to take those NUMBERS and convert them BACK into their ascii Chars.
I'm using the latest version…

Finn Hindmarch
- 11
- 2
1
vote
2 answers
how to convert chr to numeric
I am new in r, i have this table first i try to open the file with
df<- read.csv("geral_modelo_inadimplencia_2.csv",sep=";",stringsAsFactors = FALSE)
,that result all datas in chr after I did try to convert to numeric with as.numeric, but…
1
vote
1 answer
Printing out all unicode emojis to file
It's possible to print the hexcode of the emoji with u'\uXXX' pattern in Python, e.g.
>>> print(u'\u231B')
⌛
However, if I have a list of hex code like 231B, just "adding" the string won't work:
>>> print(u'\u' + ' 231B')
File "", line…

alvas
- 115,346
- 109
- 446
- 738
1
vote
1 answer
how to increment ascii ord by key value
I want to crypt a string by incrementation of ASCII by a key value. But with this code i got a problem.
def caesar_cipher(str, key)
new_sentence = []
str.split("").each do |letter|
ascii = letter.ord
puts ascii
ascii…

ffouquet42
- 124
- 13
1
vote
0 answers
Is there a way to reorder CHR rules at runtime in prolog?
I am writing a program for an artistic purpose in Prolog with heavy reliance on a large set of CHR rules. I would like to be able to run many times, but produce a different output each time. The easiest way to do this would be to…

lightning
- 389
- 1
- 9
1
vote
1 answer
PHP - Concatenation of chr function returns an image
I have stumbled upon this link. It's about chr function in PHP. There is an example in this link that I can't understand.
declare(encoding='UTF-8');
$str = chr(240) . chr(159) . chr(144) . chr(152);
echo $str;
This code gives "an elephant image" as…

david
- 3,225
- 9
- 30
- 43