string

strings with wildcards matching

Hi all I need to match two strings with simple wildcards: "oh.my.*" matches "*.my.life", "oh.my.goodness" and "*.*.*", but not "in.my.house" The only wildcard is *, which substitutes string of any character (minus .) I thought of using fnmatch, but it does not accept wildcards in file name. There is some code with regex which i am u...

String Selection Sort C++

How would I modify a selectionSort function to search an array of strings? void selectionSort (int array[], int size) { int startScan, min Index, minValue; for (startScan = 0; startScan<(size-1); startScan++) { minIndex=startScan; minValue=array[startScan]; for(int index = startScan + 1;index<size;ind...

Algorithm to find multiple string matches

I'm looking for suggestions for an efficient algorithm for finding all matches in a large body of text. Terms to search for will be contained in a list and can have 1000+ possibilities. The search terms may be 1 or more words. Obviously I could make multiple passes through the text comparing against each search term. Not too efficient. ...

Why is my asp.net causing a runtime error?

I am trying to connect to a database on my local server. The database is called "dbtest." Of course, I have left off my actual password and replaced it with "password." This is the typical code I see on every tutorial, but it doesn't work at all. Please help. <% Dim con, rs con = Server.CreateObject("ADODB.Connection") 'I thin...

How do I create a string of blanks in C++?

I need to create a string of blanks in c++, where the number of spaces is a variable, so I can't just type it in. How do I do this without looping ? Thanks! ...

Converting string to timestamp ?

Hi, I have a xml file in which date is represented as this: "2010-07-10T14:46:00.000Z" Im parsing it and fetching it as string. I need to convert it into timestamp or date format to store in db. How do i do it? Please help. ...

Problem with UTF-8 String and binary data

prehistory: http://stackoverflow.com/questions/3262013/java-regular-expression-for-binary-string I can extract a substring with binary data I need, but when I use String s = matcher.group(1); It seems that data is spoiled, to be exact spoiled are only those chars that belong to extended ASCII table, probably from 128 to 255. Othe...

How can I hide a string and replace it with a view/hide button using jQuery?

I have a field that is dynamically being filled. I know that the first few words of the string are always going to be: The order was manually edited: This is followed by a list of all the edits that was made. This list can be somewhat long sometimes. I want to hide the list of edits, and replace it with a button that says 'Click...

C inline assembly on linux, write string from stack to stdout

how can i write a string (eg. "Hello") to stdout from the stack? without, data-segments, that is. void main() { __asm__( "movl $0x4, %eax \n\t" "movl $0x1, %ebx \n\t" // put "Hello" on the stack and load its address into %ecx "movl $0x5, %edx \n\t" ...

Is there an easy way to change a char in a string in C#?

Hi, I want to do this: string s = "abc"; s[1] = 'x'; and s will become "axc". However, it seems that string[i] only has a getter and has no setter. The compiler gives me the following error: "Property or indexer 'string.this[int]' cannot be assigned to -- it is read only" I guess I could make a loop and change the char i wa...

How can I select a string within a string and save it into a variable with jQuery?

I have a string that is dynamically entered into: <span class="note_message">The order was manually edited:<br/>The list of edits goes here, and this maybe somewhat long sometimes</span> That is an example of a string that may be entered into the span. It ALWAYS starts with "The order was manually edited:", so I would like to use jQue...

Format file size as MB, GB etc

I need to display a file size as String using sensible units. e.g. 1L ==> "1 B"; 1024L ==> "1 KB"; 2537253L ==> "2.3 MB" etc. I found this previous answer, which I didn't find satisfatory I have come up with my own solution which has similar shortcomings: private static final long K = 1024; private static final long M = K * K; pri...

An explode() function that ignores characters inside quotes?

Does somebody know a quick and easy explode() like function that can ignore splitter characters that are enclosed in a pair of arbitrary characters (e.g. quotes)? Example: my_explode( "/", "This is/a string/that should be/exploded.//But 'not/here',/and 'not/here'" ); should result in an array with the following members: This is...

ActiveRecord / MySQL Select Condition Comparing String Components

I have a string that is defined as one or more dot-separated integers like 12345, 543.21, 109.87.654, etc. I'm storing values in a MySQL database and then need to find the rows that compare with a provided value. What I want is to select rows by comparing each component of the string against the corresponding component of the input strin...

Setting a custom allocator for strings

I know I can set a custom allocator for vectors using the syntax vector<T, Alloc>. Is there a way I can do the same for strings? ...

MySQL - Check if a string contains numbers

Hello, how do I check if a string in a MySQL field contains a number then delete them? Example table: tbl_tags ------------- | id | tag | ------------- | 1 | hello | | 2 | hello2 | | 3 | 2hello | | 4 | hel3lo | ------------- The only way I can think of is to do each number individually and use LIKE '%1%' OR LIKE '%2%' etc....

Makefile, modify list

If I have a list in a GNU Makefile, is it possible to create a new list with the original strings modified. This is would be perfect if there was the map higher-order procedure from some languages. This is an example of what I'm trying to do DIRS=A B C D #apply some magic to create DIRS_INCLUDE=-IA -IB -IC -ID ...

(iPhone app) error: too many arguments to function 'URLWithString:'

I'm trying to format a URL string however it's saying there are too many arguments. My code is below: -(IBAction)tweetRandom { //NSLog(@"CALLED"); test = 100; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://twitter.com/%i", test]]; // problem line } Anyone know how to format the URL? Was hoping there was ...

outlaw string in c# using intellesence

Hi, I often type string in c# when actually I want to type String. I know that string is an alias of String and I am really just being pedantic but i wish to outlaw string to force me to write String. Can this be done in ether visual studio intellesence or in resharper and how? ...

How to get the real characters from its raw utf format in Java

I have some chinese charactors encoded like this: String b = "\\u91d1\\u5143\\u6bd4\\u8054\\u6210\\u957f\\u52a8\\u529b"; How can I change the string b into the real characters, I found the below c can be shown when I output it in the console, then the question would be how to change the string b into c? String c = "\u91d1\u5143\u6bd4...