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
39
votes
1 answer

What are the differences between concatenating strings with cat() and paste()?

What are the differences between concatenating strings with cat and paste? In particular, I have the following questions. Why does R not use the double quote (") when it prints the results of calling cat (but it uses quotes when using paste)? >…
Sam
  • 4,357
  • 6
  • 36
  • 60
39
votes
6 answers

How can I clean source code files of invisible characters?

I have a bizarre problem: Somewhere in my HTML/PHP code there's a hidden, invisible character that I can't seem to get rid of. By copying it from Firebug and converting it I identified it as  or 'Zero width no-break space'. It shows up as…
deceze
  • 510,633
  • 85
  • 743
  • 889
38
votes
5 answers

How do I convert a Char to Int?

So I have a String of integers that looks like "82389235", but I wanted to iterate through it to add each number individually to a MutableList. However, when I go about it the way I think it would be handled: var text = "82389235" for (num in text)…
ibroadsword
  • 383
  • 1
  • 3
  • 6
38
votes
6 answers

How to remove accents from values in columns?

How do I change the special characters to the usual alphabet letters? This is my dataframe: In [56]: cities Out[56]: Table Code Country Year City Value 240 Åland Islands 2014.0 MARIEHAMN 11437.0 1 240 …
Marius
  • 397
  • 1
  • 3
  • 5
38
votes
11 answers

Special Characters in FPDF with PHP

I have a web form that users can fill out and that content fills up a PDF with FPDF and PHP. When a user enters a word with an apostrophe, a slash appears before it on the PDF. Similarly, special characters like trademark symbols are encoded…
Carson
  • 4,541
  • 9
  • 39
  • 45
38
votes
5 answers

How to find out if letter is Alphanumeric or Digit in Swift

I want to count the number of letters, digits and special characters in the following string: let phrase = "The final score was 32-31!" I tried: for tempChar in phrase { if (tempChar >= "a" && tempChar <= "z") { letterCounter++ } //…
sirab333
  • 3,662
  • 8
  • 41
  • 54
38
votes
10 answers

Set of unambiguous looking letters & numbers for user input

Is there an existing subset of the alphanumerics that is easier to read? In particular, is there a subset that has fewer characters that are visually ambiguous, and by removing (or equating) certain characters we reduce human error? I know "visually…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
38
votes
6 answers

How to compare character ignoring case in primitive types

I am writing these lines of code: String name1 = fname.getText().toString(); String name2 = sname.getText().toString(); aru = 0; count1 = name1.length(); count2 = name2.length(); for (i = 0; i < count1; i++) { for (j = 0; j < count2; j++) …
Arush Kamboj
  • 673
  • 3
  • 10
  • 20
37
votes
5 answers

Converting a character code to char (VB.NET)

I'm able to convert a character to its corresponding character/ASCII code using "Asc(CHAR)". What can I use to convert this returned integer back to its original character form?
Freesnöw
  • 30,619
  • 30
  • 89
  • 138
36
votes
6 answers

How to use ArrayList.addAll()?

I want to fill an ArrayList with these characters +,-,*,^ etc. How can I do this without having to add every character with arrayList.add()?
masb
  • 2,813
  • 3
  • 20
  • 20
36
votes
2 answers

In Java, should I escape a single quotation mark (') in String (double quoted)?

In Java, \' denotes a single quotation mark (single quote) character, and \" denotes a double quotation mark (double quote) character. So, String s = "I\'m a human."; works well. However, String s = "I'm a human." does not make any compile errors,…
Naetmul
  • 14,544
  • 8
  • 57
  • 81
36
votes
9 answers

How to recursively replace character in keys of a nested dictionary?

I'm trying to create a generic function that replaces dots in keys of a nested dictionary. I have a non-generic function that goes 3 levels deep, but there must be a way to do this generic. Any help is appreciated! My code so far: output = {'key1':…
Bas Tichelaar
  • 397
  • 1
  • 4
  • 6
35
votes
9 answers

Get the last 4 characters of output from standard out

I have a script that is running and uses lspci -s 0a.00.1 This returns 0a.00.1 usb controller some text device 4dc9 I want to get those last 4 characters inline such that lspci -s 0a.00.1 | some command to give me the last 4 characters.
EST
  • 407
  • 1
  • 7
  • 10
35
votes
11 answers

What is the easiest way to generate a String of n repeated characters?

Given a character c and a number n, how can I create a String that consists of n repetitions of c? Doing it manually is too cumbersome: StringBuilder sb = new StringBuilder(n); for (int i = 0; i < n; ++i) { sb.append(c); } String result =…
foobar
  • 4,968
  • 3
  • 17
  • 11
35
votes
4 answers

ASCII value of character in Ruby

How do I obtain the ASCII value of a character in Ruby 1.9? I searched the Internet far and wide, but without success. I tried ?x and "x"[0], but all they return is "x".
LakatosI
  • 395
  • 1
  • 3
  • 9