Questions tagged [alphabet]

319 questions
656
votes
11 answers

Alphabet range in Python

How do I create a list of alphabet characters, without doing it manually like this? ['a', 'b', 'c', 'd', ..., 'z']
Alexa Elis
  • 7,149
  • 6
  • 17
  • 11
196
votes
12 answers

Convert integer into its character equivalent, where 0 => a, 1 => b, etc

I want to convert an integer into its character equivalent based on the alphabet. For example: 0 => a 1 => b 2 => c 3 => d etc. I could build an array and just look it up when I need it but I’m wondering if there’s a built in function to do this…
VIVA LA NWO
  • 3,852
  • 6
  • 24
  • 21
125
votes
3 answers

How do I iterate through the alphabet?

In Python, could I simply ++ a char? What is an efficient way of doing this? I want to iterate through URLs and generate them in the following…
MillsOnWheels
  • 1,353
  • 2
  • 8
  • 4
114
votes
14 answers

Generating an array of letters in the alphabet

Is there an easy way to generate an array containing the letters of the alphabet in C#? It's not too hard to do it by hand, but I was wondering if there was a built in way to do this.
Helephant
  • 16,738
  • 8
  • 39
  • 36
88
votes
17 answers

Better way to generate array of all letters in the alphabet

Right now I'm doing for (char c = 'a'; c <= 'z'; c++) { alphabet[c - 'a'] = c; } but is there a better way to do it? Similar to Scala's 'a' to 'z'
Stupid.Fat.Cat
  • 10,755
  • 23
  • 83
  • 144
86
votes
7 answers

Quickest way to enumerate the alphabet

I want to iterate over the alphabet like so: foreach(char c in alphabet) { //do something with letter } Is an array of chars the best way to do this? (feels hacky) Edit: The metric is "least typing to implement whilst still being readable and…
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
77
votes
7 answers

Most efficient way to get next letter in the alphabet using PHP

Given any character from a to z, what is the most efficient way to get the next letter in the alphabet using PHP?
Mathias Bynens
  • 144,855
  • 52
  • 216
  • 248
73
votes
7 answers

Get character position in alphabet

I'm 90% sure there is a built in function that does this. I need to find the position of a character in an alphabet. So the character "b" is position 1 (counting from 0), etc. Does anyone know what the function is called? What I'm trying to do is to…
qwerty
  • 973
  • 2
  • 9
  • 10
51
votes
13 answers

Is there a fast way to generate a dict of the alphabet in Python?

I want to generate a dict with the letters of the alphabet as the keys, something like letter_count = {'a': 0, 'b': 0, 'c': 0} what would be a fast way of generating that dict, rather than me having to type it in? Thanks for your help. EDIT Thanks…
Nope
  • 34,682
  • 42
  • 94
  • 119
51
votes
4 answers

Creating a sequential list of letters with R

I would like to be able to create a sequence of letters in R (to assist in importing data from a SPSS file) It's quite easy to create a sequence of numbers, for example: seq(1,1000) [1] 1 2 3 4 5 6 ... 1000 paste("something_",1:12,sep="") [1]…
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255
28
votes
10 answers

Are there programming languages that rely on non-latin alphabets?

Every programming language I have ever seen has been based on the Latin alphabet, this is not surprising considering I live in Canada... But it only really makes sense that there would be programming languages based on other alphabets, or else…
Jaxsun
  • 526
  • 6
  • 11
23
votes
5 answers

How do I increment a variable to the next or previous letter in the alphabet?

I have a capital letter defined in a variable string, and I want to output the next and previous letters in the alphabet. For example, if the variable was equal to 'C', I would want to output 'B' and 'D'.
raleighJ
  • 233
  • 1
  • 2
  • 4
20
votes
6 answers

Writing whole alphabet in Vim

I sometimes need to write the whole alphabet abcd…z and I hate typing it letter by letter in Vim's insert mode. Does there exist any method to do this more efficiently? I know about the ga command which gives me the ascii code of the character where…
Maria Matejka
  • 203
  • 2
  • 6
18
votes
2 answers

Randomly choosing from a list with weighted probabilities

I have an array of N elements (representing the N letters of a given alphabet), and each cell of the array holds an integer value, that integer value meaning the number of occurrences in a given text of that letter. Now I want to randomly choose a…
Setzer22
  • 1,589
  • 2
  • 13
  • 29
18
votes
10 answers

Iterating through the Alphabet - C# a-caz

I have a question about iterate through the Alphabet. I would like to have a loop that begins with "a" and ends with "z". After that, the loop begins "aa" and count to "az". after that begins with "ba" up to "bz" and so on... Anybody know some…
subprime
  • 1,217
  • 8
  • 20
  • 34
1
2 3
21 22