Questions tagged [character]

Refers to a symbol that represents a letter or number. Also, the bit pattern used to represent such a symbol.

In computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written form of a natural language. Examples of characters include letters, numerical digits, and common punctuation marks (such as '.' or '-'). The concept also includes control characters, which do not correspond to symbols in a particular natural language, but rather to other bits of information used to process text in one or more languages. Computers and communication equipment represent characters using a character encoding that assigns each character to something — an integer quantity represented by a sequence of bits, typically — that can be stored or transmitted through a network. Two examples of popular encodings are ASCII and the UTF-8 encoding for Unicode.

7762 questions
67
votes
6 answers

HTML character codes for this ▲ or this ▼

What are the HTML entity character codes for this up arrow (▲) and its downward-facing dog version (▼) ? I've been using GIFs to represent these arrows since I don't know their codes.
Ram
  • 1,016
  • 4
  • 15
  • 25
66
votes
11 answers

Representing EOF in C code?

The newline character is represented by "\n" in C code. Is there an equivalent for the end-of-file (EOF) character?
static_rtti
  • 53,760
  • 47
  • 136
  • 192
62
votes
10 answers

What are all of the allowable characters for people's names?

There are the standard A-Z, a-z characters, but also there are hyphens, em dashes, quotes, etc. Plus, there are all of the international characters, like umlauts, etc. So, for an English-based system, what's the complete set? What about sets for…
Paul W Homer
  • 2,728
  • 1
  • 19
  • 25
60
votes
4 answers

How to split strings into characters in Scala

For example, there is a string val s = "Test". How do you separate it into t, e, s, t?
sam
  • 2,093
  • 3
  • 17
  • 10
57
votes
9 answers

How do I read input character-by-character in Java?

I am used to the c-style getchar(), but it seems like there is nothing comparable for java. I am building a lexical analyzer, and I need to read in the input character by character. I know I can use the scanner to scan in a token or line and parse…
Jamison Dance
  • 19,896
  • 25
  • 97
  • 99
56
votes
9 answers

Convert a single character to a string?

Simple question (in C++): How do I convert a single character into a string. So for example, I have string str = "abc"; And I want to extract the first letter, but I want it to be a string as opposed to a character. I tried string firstLetter =…
MLP
  • 735
  • 2
  • 7
  • 7
55
votes
8 answers

How to iterate over a String, char by char, in Dart?

I don't see Dart strings treated as lists of characters. I assume I have to use for loops, which would be lame.
mcandre
  • 22,868
  • 20
  • 88
  • 147
54
votes
9 answers

How to convert an Int to a Character in Swift

I've struggled and failed for over ten minutes here and I give in. I need to convert an Int to a Character in Swift and cannot solve it. Question How do you convert (cast) an Int (integer) to a Character (char) in Swift? Illustrative Problem/Task…
J-Dizzle
  • 4,861
  • 4
  • 40
  • 50
53
votes
11 answers

getch and arrow codes

I'm writing a programm that's using getch() to scan for arrow keys. My code so far is: switch(getch()) { case 65: // key up break; case 66: // key down break; case 67: // key right break; case 68: …
qwertz
  • 14,614
  • 10
  • 34
  • 46
52
votes
5 answers

Output single character in C

When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?
Aydya
  • 1,867
  • 3
  • 20
  • 22
52
votes
1 answer

How to get string from ASCII code in Swift?

How can I get a character from a ASCII code in Apple's new Swift? For example 65 would returns "A".
YourMJK
  • 1,429
  • 1
  • 11
  • 22
51
votes
5 answers

Java - what are characters, code points and surrogates? What difference is there between them?

I'm trying to find an explanation of the terms "character", "code point" and "surrogate", and while these terms aren't limited to Java, if there are any language-specific differences I'd like the explanation as it relates to Java. I've found some…
Alium Britt
  • 1,246
  • 4
  • 13
  • 25
48
votes
10 answers

Create a sequence between two letters

I want to create a sequence between two letters let's say "b" and "f". So the output is "b" "c" "d" "e" "f" For numbers, we can do 2:6 #which gives output as [1] 2 3 4 5 6 Is there an easy way to do this with letters as well? I have gone…
Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
48
votes
13 answers

How add separator to string at every N characters in swift?

I have a string which contains binary digits. How to separate it in to pairs of digits? Suppose the string is: let x = "11231245" I want to add a separator such as ":" (i.e., a colon) after each 2 characters. I would like the output to…
Bolo
  • 2,668
  • 4
  • 27
  • 34
48
votes
12 answers

How to concatenate characters in java?

How do you concatenate characters in java? Concatenating strings would only require a + between the strings, but concatenating chars using + will change the value of the char into ascii and hence giving a numerical output. I want to do…
Wilson