alphanumeric

C# Method like Base64String, but only alphanumeric (no plus or slash)

▼魔方 西西 提交于 2019-12-04 18:06:35
问题 is there any C# method that works similar to Convert.ToBase64String but doesn't generate anything except alphanumeric output? Thanks! 回答1: You're probably looking at using something like Base32 encoding then. There is a Base32 encoder/decoder for C# here by Michael Giagnocavo. It uses a combination of capitalized letters and numbers. There's also a related discussion on StackOverflow here. EDIT: And if by any chance this is for URL-safe related Base64 encoding, just do Base64 and replace "+"

“Alphanumeric” hash - A-Z, 0-9

感情迁移 提交于 2019-12-04 16:49:00
问题 I'm looking for a function that will generate an "alphanumeric hash". Given a source string, it produces a determinate result string that can contain any letter a-z or digit 0-9, and cannot be reverse-engineered to produce the source. This will be used to generate passwords for a system based on secret data, so strings between 8 and 12 characters are ideal and a secure hash would also be ideal. I'm thinking I can use a normal bitwise hash, XOR-fold it to 64 bits (if I use, for instance,

Strip down everything, except alphanumeric and European characters in PHP

天涯浪子 提交于 2019-12-04 10:25:19
I am working on validating my commenting script, and I need to strip down all non-alphanumeric chars except those used in Western Europe. My plan is to regex out all non-alphanumeric characters with: preg_replace("/[^A-Za-z0-9 ]/", '', $string); But that so far strips out all European characters and a £ sign, so "Café Rouge" becomes "Caf Rouge". How can I add an array of Euro chars to the above regex. The array is: £, €, á, à, â, ä, æ, ã, å, è, é, ê, ë, î, ï, í, ì, ô, ö, ò, ó, ø, õ, û, ü, ù, ú, ÿ, ñ, ß I use UTF-8 SOLUTION: $comment = preg_replace('/[^\p{Latin}\d\s\p{P}]/u', '', $comment); and

How to do alpha numeric sort perl?

孤者浪人 提交于 2019-12-04 06:32:29
问题 I have a file which looks like this: 80,1p21 81,19q13 82,6p12.3 83,Xp11.22 84,3pter-q21 86,3q26.33 87,14q24.1-q24.2|14q24|14q22-q24 88,1q42-q43 89,11q13.1 90,2q23-q24 91,12q13 92,2q22.3 93,3p22 94,12q11-q14 95,3p21.1 97,14q24.3 98,2p16.2 And I want to sort them based on second column. And the first column should change accordingly too. When you use sort command in perl, it doesn't do it because it says its not numeric. Is there a way to sort things alpha numerically in perl? Thanks. 回答1: If

Check if a String is alphanumeric in Swift

早过忘川 提交于 2019-12-03 14:30:14
问题 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, é. 回答1: extension String { var isAlphanumeric: Bool { return !isEmpty && range(of: "[^a-zA-Z0-9]", options: .regularExpression) == nil } } "".isAlphanumeric // false "abc".isAlphanumeric // true "123".isAlphanumeric // true "ABC123".isAlphanumeric // true "iOS 9".isAlphanumeric // false 回答2: A modern Swift 3 and 4 solution

C# Method like Base64String, but only alphanumeric (no plus or slash)

十年热恋 提交于 2019-12-03 11:34:18
is there any C# method that works similar to Convert.ToBase64String but doesn't generate anything except alphanumeric output? Thanks! Xiaofu You're probably looking at using something like Base32 encoding then. There is a Base32 encoder/decoder for C# here by Michael Giagnocavo. It uses a combination of capitalized letters and numbers. There's also a related discussion on StackOverflow here . EDIT: And if by any chance this is for URL-safe related Base64 encoding, just do Base64 and replace "+" with "-" and "/" with "_". But I'm guessing, you may not want it for that. The answers are a bit

What is the probability of collision with a 6 digit random alphanumeric code?

巧了我就是萌 提交于 2019-12-03 11:29:18
问题 I'm using the following perl code to generate random alphanumeric strings (uppercase letters and numbers, only) to use as unique identifiers for records in my MySQL database. The database is likely to stay under 1,000,000 rows, but the absolute realistic maximum would be around 3,000,000. Do I have a dangerous chance of 2 records having the same random code, or is it likely to happen an insignificantly small number of times? I know very little about probability (if that isn't already

Check if a String is alphanumeric in Swift

Deadly 提交于 2019-12-03 04:19:16
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, é. extension String { var isAlphanumeric: Bool { return !isEmpty && range(of: "[^a-zA-Z0-9]", options: .regularExpression) == nil } } "".isAlphanumeric // false "abc".isAlphanumeric // true "123".isAlphanumeric // true "ABC123".isAlphanumeric // true "iOS 9".isAlphanumeric // false A modern Swift 3 and 4 solution extension String { func isAlphanumeric() -> Bool { return self.rangeOfCharacter(from: CharacterSet.alphanumerics

What is the probability of collision with a 6 digit random alphanumeric code?

*爱你&永不变心* 提交于 2019-12-03 01:54:07
I'm using the following perl code to generate random alphanumeric strings (uppercase letters and numbers, only) to use as unique identifiers for records in my MySQL database. The database is likely to stay under 1,000,000 rows, but the absolute realistic maximum would be around 3,000,000. Do I have a dangerous chance of 2 records having the same random code, or is it likely to happen an insignificantly small number of times? I know very little about probability (if that isn't already abundantly clear from the nature of this question) and would love someone's input. perl -le 'print map { ("A"..

jquery alphanumeric validation

孤街醉人 提交于 2019-12-02 21:04:57
问题 $('#reg_submit').click(function () { var reg_password1 = $('#reg_password1').val(); letters = /([a-z])([0-9])/; var errorMessage = ''; if ( ! reg_password1.value.match(letters) ) { errorMessage = "Password must be alphanumeric"; $('#msg_regpass1').html(errorMessage).show(); } else { $('#msg_regpass1').html('').hide(); } }); i used the above jquery code for applying alphanumeric validation to my registration page.but i am getting the javascript error related to match(), something match is