alphanumeric

Sorting a generic list on arbitrary property alphanumerically in c#

感情迁移 提交于 2019-12-24 01:27:46
问题 Is it possible to sort a generic list on arbitrary property alphanumerically in c#? Let me know if the question is not clear and I will come up with an example. Thanks in advance Note: I have found this link that does it but not alphanumerically. Can anyone help me out? http://blog.codewrench.net/2009/04/14/sorting-a-generic-list-on-arbitrary-property/ 回答1: here is a fast alphanumeric sort (can be used for other sorts with numerics too). C# Alphanumeric Sorting http://www.dotnetperls.com

Checking for alphanumeric characters and getting input from HTML form

≡放荡痞女 提交于 2019-12-23 16:20:01
问题 I'm fairly new to programming in Perl and I have a couple of compilation issues I can't seem to resolve. My program gets input from this HTML form. Question: Should my form use the post or get method? <FORM action="./cgi-bin/Perl.pl" method="GET"> <br> Full name: <br><input type="text" name="full_name" maxlength="20"><br> Username: <br><input type="text" name="user_name" maxlength="8"><br> Password: <br><input type="password" name="password" maxlength="15"><br> Confirm password: <br><input

Extracting alpha and numeric parts from a column

我与影子孤独终老i 提交于 2019-12-21 12:56:15
问题 I have a table tab1 with a column col1 that has compound alpha-then-numeric values, like this: abc123 xy45 def6 z9 I need to extract the values as separate columns in a query, with the numeric part in a column of integer datatype. If the two values had a consistent start and end positions, the job could be done with substring() , as you can see the start of the numeric part varies. Is there an elegant way to tackle this, or must it be done with a series of unions of each possible start point

How to sort an alphanumeric array in ruby

左心房为你撑大大i 提交于 2019-12-20 02:26:17
问题 How I can sort array data alphanumerically in ruby? Suppose my array is a = [test_0_1, test_0_2, test_0_3, test_0_4, test_0_5, test_0_6, test_0_7, test_0_8, test_0_9, test_1_0, test_1_1, test_1_2, test_1_3, test_1_4, test_1_5, test_1_6, test_1_7, test_1_8, test_1_9, test_1_10, test_1_11, test_1_12, test_1_13, test_1_14, ...........test_1_121...............] I want my output to be: . . . test_1_121 . . . test_1_14 test_1_13 test_1_12 test_1_11 test_1_10 test_1_9 test_1_8 test_1_7 test_1_6 test

Removing spaces and anything that is not alphanumeric

自古美人都是妖i 提交于 2019-12-19 18:42:00
问题 I'm trying to remove everything that is not alphanumeric, or is a space with _: $filename = preg_replace("([^a-zA-Z0-9]|^\s)", "_", $filename); What am I doing wrong here, it doesn't seem to work. I've tried several regex combinations...(and I'm generally not very bright). 回答1: Try this: $filename = preg_replace("/[^a-zA-Z0-9 ]/", "_", $filename); 回答2: $filename = preg_replace('~[\W\s]~', '_', $filename); If I understand your question correctly, you want to replace any space (\s) or non

Removing spaces and anything that is not alphanumeric

与世无争的帅哥 提交于 2019-12-19 18:41:56
问题 I'm trying to remove everything that is not alphanumeric, or is a space with _: $filename = preg_replace("([^a-zA-Z0-9]|^\s)", "_", $filename); What am I doing wrong here, it doesn't seem to work. I've tried several regex combinations...(and I'm generally not very bright). 回答1: Try this: $filename = preg_replace("/[^a-zA-Z0-9 ]/", "_", $filename); 回答2: $filename = preg_replace('~[\W\s]~', '_', $filename); If I understand your question correctly, you want to replace any space (\s) or non

Sorting hash keys by Alphanumeric sort

一曲冷凌霜 提交于 2019-12-19 11:33:46
问题 I have just read the post Sorting alphanumeric hash keys in Perl? . But I am starting with Perl, and I don't understand it very clearly. So I have a hash like this one: %hash = ( "chr1" => 1, "chr2" => 3, "chr19" => 14, "chr22" => 1, "X" => 2, ) I'm trying to obtain output like this: chr1 chr2 chr19 chr22 But I'm obtaining output like this: chr1 chr19 chr2 chr22 I have written this code, but it is creating the above wrong output: foreach my $chr (sort {$a cmp $b} keys(%hash)) { my $total=

Sorting VARCHAR column with alphanumeric entries

南楼画角 提交于 2019-12-19 02:54:16
问题 I am using SQL Server, the column is a VARCHAR(50) and I want to sort it like this: 1A 1B 2 2 3 4A 4B 4C 5A 5B 5C 5N 14 Draft 21 22A 22B 23A 23B 23C 23D 23E 25 26 FR01584 MISC What I have so far is: Select * From viewASD ORDER BY Case When IsNumeric(LEFT(asdNumNew,1)) = 1 Then CASE When IsNumeric(asdNumNew) = 1 Then Right(Replicate('0',20) + asdNumNew + '0', 20) Else Right(Replicate('0',20) + asdNumNew, 20) END When IsNumeric(LEFT(asdNumNew,1)) = 0 Then Left(asdNumNew + Replicate('',21), 20)

Postgresql sorting mixed alphanumeric data

守給你的承諾、 提交于 2019-12-18 13:06:12
问题 Running this query: select name from folders order by name returns these results: alphanumeric a test test 20 test 19 test 1 test 10 But I expected: a test alphanumeric test 1 test 10 test 19 test 20 What's wrong here? 回答1: You can simply cast name column to bytea data type allowing collate-agnostic ordering: SELECT name FROM folders ORDER BY name::bytea; Result: name -------------- a test alphanumeric test 1 test 10 test 19 test 20 (6 rows) 回答2: All of this methods sorted my selection in

Sort AlphaNumeric with structured references in Excel

依然范特西╮ 提交于 2019-12-17 21:12:45
问题 I Have an Excel Sheet with data that looks like that. Data x=1.1 x=11.2 x=10.3 x=1.4 x=2.5;2.6 x=2.1 x=4.7 x=6.8 x=6.2;6.3 x=1.10 What i want to do is, to sort the List that it Looks like that. DataSort x=1.1 x=1.4 x=1.10 x=2.1 x=2.5;2.6 x=4.7 x=6.2;6.3 x=6.8 x=10.3 x=11.2 I tried to do that with that Formula =LEFT(Tabelle1[[#this row];[Data]];2) & TEXT(SUBSTITUTE(Tabelle1[[#this row];[Data]];LEFT(Tabelle1[[#this row];[Data]];2);"");"#0.0#") But that did not work. Can someone give me a hint