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
48
votes
3 answers

read first 8 characters of text file with bash

I would like to read only the first 8 characters of a text file and save it to a variable in bash. Is there a way to do this using just bash?
user788171
  • 16,753
  • 40
  • 98
  • 125
47
votes
6 answers

How to convert character of percent into numeric in R

I have data with percent signs (%) that I want to convert into numeric. I run into a problem when converting character of percentage to numeric. E.g. I want to convert "10%" into 10%, but as.numeric("10%") returns NA. Do you have any ideas?
Frank Wang
  • 1,462
  • 3
  • 17
  • 39
46
votes
2 answers

Is it necessary to use — and – in XHTML or HTML5?

It seems that it is best to use the & escape, instead of simply typing the ampersand (&). However, should we be using X/HTML character entity references for dashes and other common typographical characters when writing blog posts on CMSs like…
45
votes
6 answers

Delete first 3 characters and last 3 characters from String PHP

I need to delete the first 3 letters of a string and the last 3 letters of a string. I know I can use substr() to start at a certain character but if I need to strip both first and last characters i'm not sure if I can actually use this. Any…
Howdy_McGee
  • 10,422
  • 29
  • 111
  • 186
43
votes
2 answers

Delphi ^A syntax: Documented, implied, or undocumented?

Let me explain by an example. In Delphi, you can write procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if Key = ^C then ShowMessage('The user wants to copy something.') else if Key = ^V then ShowMessage('The user…
Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
43
votes
2 answers

How to find a character index in Golang?

I'm trying to find "@" string character in Go but I cannot find a way to do it. I know how to index characters like "HELLO[1]" which would output "E". However I'm trying to find index number of the found char. In Python I'd do it in following way: x…
mobu
  • 547
  • 3
  • 6
  • 11
42
votes
9 answers

Android character by character display text animation

Anyone knows any efficient method of perform an animation that what is has to do is to display a text, character by character? Like: T Th Thi This This i This is ... And so on. Thanks!
zegnus
  • 1,437
  • 3
  • 17
  • 23
42
votes
5 answers

Generate a sequence of characters from 'A'-'Z'

I can make a sequence of numbers like this: s = seq(from=1, to=10, by=1) How do I make a sequence of characters from A-Z? This doesn't work: seq(from=1, to=10)
James Thompson
  • 46,512
  • 18
  • 65
  • 82
42
votes
10 answers

Swift How to get integer from string and convert it into integer

I need to extract numbers from string and put them into a new array in Swift. var str = "I have to buy 3 apples, 7 bananas, 10eggs" I tried to loop each characters and I have no idea to compare between Characters and Int.
alphonse
  • 687
  • 1
  • 6
  • 16
41
votes
9 answers

Character with encoding UTF8 has no equivalent in WIN1252

I am getting the following exception: Caused by: org.postgresql.util.PSQLException: ERROR: character 0xefbfbd of encoding "UTF8" has no equivalent in "WIN1252" Is there a way to eradicate such characters, either via SQL or programmatically? (SQL…
Monis Iqbal
  • 1,987
  • 7
  • 26
  • 42
41
votes
2 answers

Look at each character in a string

I was wondering if anyone knew how to look through a string at each character and then add each character to a new string? Just a really really basic example, I can add the ToUpper and ToLower validation and such.
user1290653
  • 775
  • 3
  • 11
  • 23
40
votes
11 answers

Java: How to split a string by a number of characters?

I tried to search online to solve this question but I didn't found anything. I wrote the following abstract code to explain what I'm asking: String text = "how are you?"; String[] textArray= text.splitByNumber(4); //this method is what I'm…
Meroelyth
  • 5,310
  • 9
  • 42
  • 52
39
votes
10 answers

Number of Occurrences of a Character in NSString

I have an NSString or NSMutableString and would like to get the number of occurrences of a particular character. I need to do this for quite a few characters -- uppercase English characters in this case -- so it would be nice for it to be quick.
Elliot
  • 6,086
  • 11
  • 45
  • 57
39
votes
2 answers

Load R package from character string

I want to create a function which includes loading a package that I make within the function. A short example (which doesn't run!): loadMe <- function(name){ genLib(xxx, libName = name) #make a new library with name "name" library(name) …
dynamo
  • 2,988
  • 5
  • 27
  • 35
39
votes
4 answers

Remove the first six characters from a String (Swift)

What's the best way to go about removing the first six characters of a string? Through Stack Overflow, I've found a couple of ways that were supposed to be solutions but I noticed an error with them. For instance, extension String { func…
Vandal
  • 708
  • 1
  • 8
  • 21