Questions tagged [chr]

chr() is a function in Python or PHP which returns the character (string of length one) that corresponds to an ASCII code point.

166 questions
14
votes
5 answers

Trying to get the euro symbol using chr(128)

I expected this code: define('EURO_SIMBOLO', chr(128)); $euro = EURO_SIMBOLO; var_dump($euro); to show the € symbol, but it doesn't. Why does this happen?
tirenweb
  • 30,963
  • 73
  • 183
  • 303
13
votes
4 answers

Python - Increment Characters in a String by 1

I've searched on how to do this in python and I can't find an answer. If you have a string: >>> value = 'abc' How would you increment all characters in a string by 1? So the input that I'm looking for is: >>> value = 'bcd' I know I can do it…
brazjul
  • 339
  • 2
  • 5
  • 19
9
votes
2 answers

Python's chr() and ord() in Rust

In Python you can convert an integer into a character and a character into an integer with ord() and chr(): >>>a = "a" >>>b = ord(a) + 1 >>>b = chr(b) I am looking for a way to do the same thing in Rust, but I have found nothing similar yet.
Maxtron
  • 101
  • 4
9
votes
3 answers

Converting Numbers to Excel Letter Column vb.net

I am trying to write data to excel files using vb.net. So I my function which converts number column into excel letter columns. Public Function ConvertToLetter(ByRef iCol As Integer) As String Dim Reminder_Part As Integer = iCol Mod 26 Dim…
bill
  • 147
  • 2
  • 5
  • 14
6
votes
1 answer

PHP: chr Function Issue with Special characters

In PHP i have the following code: "; echo ord("€") . "
"; echo chr(128) . "
"; And i get the following output: € 128 � Why can't the chr function provide me the € sign? How can i get the €? I really need this to work.…
BisaZ
  • 221
  • 1
  • 2
  • 9
6
votes
3 answers

String with Convert.ToChar(0) hash result different than chr(0) in PHP when hashed hash_hmac

I have a string in PHP which is being converted to a byte array and hashed. The string being converted to the byte array looks like: "g". chr(0) . "poo"; I need to equivalent byte array in C# so i can get the same hash.. EDIT: Here is the FULL…
billy jean
  • 1,399
  • 4
  • 25
  • 45
5
votes
3 answers

PHP convert an octal characters to string

Title is pretty much self explanatory... How do I echo an octal string ? I tried : '; echo decoct('\047\131\145\141\162\040\072\040\047').'
'; echo…
Steven
  • 249
  • 5
  • 14
5
votes
3 answers

How to display Unicode characters in VB6?

Possible Duplicate: What’s the best option to display Unicode text (hebrew, etc.) in VB6 What is the correct way to display the unicode character 9646 (BLACK VERTICAL RECTANGLE) in VB6? When I try ChrW(9646) it displays ?.
CJ7
  • 22,579
  • 65
  • 193
  • 321
4
votes
3 answers

asc and chr equivalent in C/C++

Well the title pretty much sums it up. I want to use something like asc("0") in C++, and want to make the program platform independent so don't want to use 48! Any help appreciated.
Appster
  • 733
  • 2
  • 10
  • 18
4
votes
3 answers

VBScript chr() appears to return wrong value

I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is: � However, when using something like Javascript's String.fromCharCode, 199 is: Ç The…
David Brown
  • 35,411
  • 11
  • 83
  • 132
4
votes
1 answer

VB.net returns chr(255) as chr(63)

I am writing a program in visual basic and have run into an odd problem. I am sending strings via serial port to a telescope mount. When I send the check string, the scope can return either chr(0) or chr(255). This works fine in python and c++…
jeffpkamp
  • 2,732
  • 2
  • 27
  • 51
4
votes
2 answers

Python chr() explain

So I am pretty sure this is a dumb question, but I am trying to get a deeper understanding of the python chr() function. Also, I am wondering if it is possible to always have the integer argument three digits long, or just a fixed length for all…
Chris Nguyen
  • 160
  • 1
  • 4
  • 14
4
votes
2 answers

Why is Chr(3) a constant expression but not Chr(172)?

If I write the following code, ReSharper will suggest I convert the first variable, chr3 to a constant, but not the second variable, chr127. Public Class ClassX Public Sub SomeMethod() Dim chr3 As String = Chr(3) Dim chr172 As…
MCattle
  • 2,897
  • 2
  • 38
  • 54
4
votes
5 answers

Python: get int value from a char string

This is one of those silly questions and I don't really know how to formulate it, so I'll give an example. I got v = chr(0xae) + chr(0xae) where #AEAE is, in decimal, the value of 44718. My question is how I get the integer value of v? I know about…
ov1d1u
  • 958
  • 1
  • 17
  • 38
3
votes
1 answer

How to check if a chr()'s output will be undefined

I'm using chr() to run through a list of unicode characters, but whenever it comes across a character that is unassigned, it just continues running, and doesnt error out or anything. How do i check if the output of chr() will be undefined? for…
VintiumDust
  • 95
  • 1
  • 6
1
2 3
11 12