Questions tagged [letters]

251 questions
34
votes
5 answers

Bash script to find the frequency of every letter in a file

I am trying to find out the frequency of appearance of every letter in the english alphabet in an input file. How can I do this in a bash script?
SkypeMeSM
  • 3,197
  • 8
  • 43
  • 61
26
votes
5 answers

Sequence of letters in Python

Is there a built-in method / module in Python to generate letters such as the built-in constant LETTERS or letters constant in R? The R built-in constant works as letters[n] where if n = 1:26 the lower-case letters of the alphabet are…
John
  • 41,131
  • 31
  • 82
  • 106
25
votes
3 answers

Capital letters in class name PHP

I have two classes in my system. One is called file and second is File. On my localhost when i instantiate file i get file object, but my friend running the same script gets object of File like the capital letters were unrecognized and "file" was…
Somal
  • 251
  • 1
  • 3
  • 3
22
votes
5 answers

simplest, shortest way to count capital letters in a string with php?

I am looking for the shortest, simplest and most elegant way to count the number of capital letters in a given string.
pablo
  • 761
  • 4
  • 8
  • 14
17
votes
7 answers

What is the best way to match only letters in a regex?

I would really like to use \w but it also matches underscores so I'm going with [A-Za-z] which feels unnecessarily verbose and America centric. Is there a better way to do this? Something like [\w^_] (I doubt I got that syntax right)?
SapphireSun
  • 9,170
  • 11
  • 46
  • 59
14
votes
4 answers

OrderBy with Swedish letters

I have a list of my custom class Customer and I want to sort them alphabetically by Title. So I wrote myList = myList.OrderByDescending(x => x.Title).ToList(); Now the problem is that this method doesn't support the Swedish way of…
Dudute
  • 357
  • 1
  • 3
  • 11
12
votes
2 answers

A loop to create the alphabet using JavaScript

I've been working on a small project for myself, and it consists of creating the alphabet. I don't want to hard code each individual letter in markup, but rather use JavaScript to do it for me. This is how far I've gotten. for ( i = 0; i < 26; i++…
John Connor
  • 175
  • 1
  • 2
  • 7
12
votes
8 answers

How do I get the set of all letters in Java/Clojure?

In Python, I can do this: >>> import string >>> string.letters 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' Is there any way to do something similar in Clojure (apart from copying and pasting the above characters somewhere)? I looked…
Jason Baker
  • 192,085
  • 135
  • 376
  • 510
7
votes
2 answers

OrderBy ignoring accented letters

I want a method like OrderBy() that always orders ignoring accented letters and to look at them like non-accented. I already tried to override OrderBy() but seems I can't do that because that is a static method. So now I want to create a custom…
Ninita
  • 1,209
  • 2
  • 19
  • 45
6
votes
4 answers

How to iterate through alpha and numeric numbers

I would like to know how in Python I can iterate through a set of conditions. string that has 2-6 lower alpha or numeric characters the first character is always a number So a short progression would…
Ryan
  • 167
  • 1
  • 3
  • 12
6
votes
10 answers

python: How do I assign values to letters?

I want to assign a value to each letter in the alphabet, so that a -> 1, b -> 2, c -> 3, ... z -> 26. Something like a function which returns the value of the letter, for example: value('a') = 1 value('b') = 2 etc... How would I go about doing this…
Eddy
  • 6,661
  • 21
  • 58
  • 71
6
votes
1 answer

How to convert Cyrillic letters to English latin in Java String?

I have string a="L1-23Миграција од VPN и промена на брзина ACTELIS Agregator alternativna 8-/208"; I would like for every my string to check if there are some Cyrillic letters in string and to convert them to English: Output should…
Veljko
  • 1,708
  • 12
  • 40
  • 80
5
votes
4 answers

PHP: is there an isLetter() function or equivalent?

I am no PHP expert. I am looking for the PHP equivalent of isLetter() in Java, but I can't find it. Does it exist? I need to extract letters from a given string and make them lower case, for example: "Ap.ér4i5T i6f;" should give "apéritif'. So, yes,…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
5
votes
8 answers

Linq query - find strings based upon first letter b/w two ranges

We have a list containing names of countries. We need to find names of countries from list b/w two letters. Like names of all countries with name starting b/w A-G and so on. We create following linq query but its ugly. var countryAG = from elements…
Malik
  • 347
  • 1
  • 11
  • 29
5
votes
6 answers

Condense list into string : ['z','y','x'...] -> 'zyx...' ? Python (2.7.1)

If I have list='abcdedcba' and i want: a=z, b=y, c=x, d=w, e=v so it would translate to: translate='zyxwvwxya' How would I do this? If I construct a dictionary >>> d=dict(zip(('a','b','c','d','e'),('z','y','x','w','v'))) and type >>> example= d[x]…
O.rka
  • 29,847
  • 68
  • 194
  • 309
1
2 3
16 17