Questions tagged [letter]

a character representing one or more of the sounds used in speech; any of the symbols of an alphabet.

368 questions
4160
votes
104 answers

How do I make the first letter of a string uppercase in JavaScript?

How do I make the first letter of a string uppercase, but not change the case of any of the other letters? For example: "this is a test" → "This is a test" "the Eiffel Tower" → "The Eiffel Tower" "/index.html" → "/index.html"
Robert Wills
  • 42,187
  • 3
  • 15
  • 6
197
votes
10 answers

python capitalize first letter only

I am aware .capitalize() capitalizes the first letter of a string but what if the first character is a integer? this 1bob 5sandy to this 1Bob 5Sandy
user1442957
  • 5,495
  • 5
  • 19
  • 18
153
votes
9 answers

What is the best way to tell if a character is a letter or number in Java without using regexes?

What is the best and/or easiest way to recognize if a string.charAt(index) is an A-z letter or a number in Java without using regular expressions? Thanks.
Daniel Sopel
  • 2,897
  • 4
  • 19
  • 17
113
votes
14 answers

How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with: var first = str.charAt(0); and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exists in Javascript. At least I cannot find it. How can I…
Jérôme Verstrynge
  • 51,859
  • 84
  • 263
  • 429
103
votes
28 answers

How to capitalize the first letter of a string in dart?

How do I capitalize the first character of a string, while not changing the case of any of the other letters? For example, "this is a string" should give "This is a string".
Kasper
  • 8,678
  • 10
  • 34
  • 53
80
votes
4 answers

Count letters in a text in the Welsh language

How do I count the letters in Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch? print(len('Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')) Says 58 Well if it was that easy I wouldn't be asking you, now would I?! Wikipedia…
Madarch
  • 811
  • 1
  • 5
42
votes
6 answers

How to detect lowercase letters in Python?

I need to know if there is a function that detects the lowercase letters in a string. Say I started writing this program: s = input('Type a word') Would there be a function that lets me detect a lowercase letter within the string s? Possibly ending…
JustaGuy313
  • 501
  • 2
  • 6
  • 10
38
votes
3 answers

In VB6 what is the difference between Property Set and Property Let?

I have just created several Property Set methods, and they didn't compile. When I changed them to Property Let, everything was fine. I have since studied the documentation to find the difference between Property Set and Property Let, but must admit…
Brian Hooper
  • 20,414
  • 23
  • 82
  • 132
34
votes
8 answers

Regex capitalize first letter every word, also after a special character like a dash

I use this #(\s|^)([a-z0-9-_]+)#i for capitalize every first letter every word, i want it also to capitalize the letter if it's after a special mark like a dash(-) Now it shows: This Is A Test For-stackoverflow And i want this: This Is A Test…
Simmer
  • 341
  • 1
  • 3
  • 5
16
votes
1 answer

How to access Letter Recognizer API in Android?

I am creating a gesture application. In the Gesture class docs http://developer.android.com/reference/android/gesture/Gesture.html) it reads: "A user-defined gesture can be recognized by a GestureLibrary and a built-in alphabet gesture can be…
Navigatron
  • 1,869
  • 6
  • 29
  • 52
16
votes
6 answers

Immediately show autocomplete on Android

The Android autocomplete only starts after two letters. How can I make it so the list appears when the field is just selected?
Mitchell
  • 881
  • 2
  • 11
  • 33
14
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,407
  • 2
  • 13
  • 24
12
votes
7 answers

How can I check if a char is a letter or a number?

I have a string and I want to loop it so that I can check if every char is a letter or number. $s = "rfewr545 345b"; for ($i=1; $i<=strlen($s); $i++){ if ($a[$i-1] == is a letter){ echo $a[$i-1]." is a letter"; } else { echo…
gadss
  • 18,755
  • 34
  • 96
  • 139
11
votes
6 answers

Determine if string starts with letters A through I

I've got a simple java assignment. I need to determine if a string starts with the letter A through I. I know i have to use string.startsWith(); but I don't want to write, if(string.startsWith("a")); all the way to I, it seems in efficient. Should I…
Archey
  • 1,182
  • 5
  • 14
  • 21
10
votes
3 answers

Automatically capitalize first letter of first word in a new sentence in LaTeX

I know one of LaTeX's bragging points is that it doesn't have this Microsoftish behavior. Nevertheless, it's sometimes useful. LaTeX already adds an extra space after you type a (non-backslashed) period, so it should be possible to make it…
memius
  • 3,835
  • 4
  • 24
  • 25
1
2 3
24 25