Questions tagged [alphanumeric]

Alphanumeric refers to strings containing a combination of letters and digits.

Alphanumeric refers to strings containing a combination of letters and digits.

In the context of English language, it contains characters lowercase a to z, uppercase A to Z and digits 0 to 9. It may contain more letters in other languages.

707 questions
1958
votes
46 answers

How to generate a random alpha-numeric string

I've been looking for a simple Java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would "likely" be unique over 500K+ generation (my needs don't really require…
Todd
  • 3,363
  • 3
  • 21
  • 12
308
votes
21 answers

How to remove leading zeros from alphanumeric text?

I've seen questions on how to prefix zeros here in SO. But not the other way! Can you guys suggest me how to remove the leading zeros in alphanumeric text? Are there any built-in APIs or do I need to write a method to trim the leading…
jai
  • 21,519
  • 31
  • 89
  • 120
218
votes
21 answers

How to strip all non-alphabetic characters from string in SQL Server?

How could you remove all characters that are not alphabetic from a string? What about non-alphanumeric? Does this have to be a custom function or are there also more generalizable solutions?
Even Mien
  • 44,393
  • 43
  • 115
  • 119
198
votes
10 answers

Replace all non alphanumeric characters, new lines, and multiple white space with one space

I'm looking for a neat regex solution to replace All non alphanumeric characters All newlines All multiple instances of white space With a single space For those playing at home (the following does work) text.replace(/[^a-z0-9]/gmi, "…
TheGeneral
  • 79,002
  • 9
  • 103
  • 141
154
votes
20 answers

Generate a random alphanumeric string in Cocoa

I want to call a method, pass it the length and have it generate a random alphanumeric string. Are there any utility libraries out there that may have a bunch of these types of functions?
Ward
  • 3,318
  • 3
  • 30
  • 50
150
votes
26 answers

How do I block or restrict special characters from input fields with jquery?

How do I block special characters from being typed into an input field with jquery?
Nerd Stalker
  • 1,509
  • 2
  • 10
  • 4
126
votes
24 answers

How do I sort strings alphabetically while accounting for value when a string is numeric?

I'm trying to sort an array of numbers that are strings and I'd like them to sort numerically. The catch is that I cannot convert the numbers into int. Here is the code: string[] things= new string[] { "105", "101", "102", "103", "90" }; foreach…
sf.
  • 24,512
  • 13
  • 53
  • 58
83
votes
8 answers

How to determine if a String has non-alphanumeric characters?

I need a method that can tell me if a String has non alphanumeric characters. For example if the String is "abcdef?" or "abcdefà", the method must return true.
lugeno
  • 1,055
  • 3
  • 10
  • 18
77
votes
3 answers

Sorting strings with numbers in Bash

I've often wanted to sort strings with numbers in them so that, when sorting e.g. abc_2, abc_1, abc_10 the result is abc_1, abc_2, abc_10. Every sort mechanism I've seen sorts as abc_1, abc_10, abc_2, that is character by character from the left.…
hardcode57
  • 1,497
  • 2
  • 11
  • 10
75
votes
18 answers

How to remove all non-alpha numeric characters from a string in MySQL?

I'm working on a routine that compares strings, but for better efficiency I need to remove all characters that are not letters or numbers. I'm using multiple REPLACE functions now, but maybe there is a faster and nicer solution ?
Dylan
  • 9,129
  • 20
  • 96
  • 153
67
votes
8 answers

HTML5 form validation pattern alphanumeric with spaces?

I have the following input tag in my html5 form:

This works just fine checking if the company name consists out of…
RTB
  • 5,773
  • 7
  • 33
  • 50
66
votes
7 answers

Determine if char is a num or letter

How do I determine if a char in C such as a or 9 is a number or a letter? Is it better to use: int a = Asc(theChar); or this? int a = (int)theChar
Mona
  • 1,043
  • 2
  • 12
  • 21
62
votes
12 answers

Regex for checking if a string is strictly alphanumeric

How can I check if a string contains only numbers and alphabets ie. is alphanumeric?
O__O
  • 950
  • 1
  • 9
  • 17
47
votes
8 answers

Check if a String is alphanumeric in Swift

In Swift, how can I check if a String is alphanumeric, ie, if it contains only one or more alphanumeric characters [a-zA-Z0-9], excluding letters with diacritics, eg, é.
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
47
votes
8 answers

How to check if a string only contains alphanumeric characters in objective C?

I'm working on a small iphone project and i would need to check if the userName entered only contains alphanumerical characters? (A-Z, a-z, 0-9. How would i go about checking it?
Cheng Lai
  • 767
  • 1
  • 9
  • 19
1
2 3
47 48