string

compare string to date on mysql

In MySQL 4.0.21-standard, I have a table with a date, saved as a string. I want to compare this string with a date in my request. SELECT FE_CLIENT.* FROM FE_CLIENT WHERE D_DATFINPUBLI < '2010/06/03' How can I cast my column date_deb to a date for compare? ...

How to overwrite specific lines on text files

I have two text files. I'd like to copy a specific part in the first text file and replace it with a part of the second text file. This is how I read the files: List<string> PrevEp = File.ReadAllLines(string.Format(@"{0}naruto{1}.ass", url, PrevEpNum)).ToList(); List<string> Ep = File.ReadAllLines(string.Format(@"{0}naruto{1}.ass", url...

How to split byte strings with a space in AutoIt?

I would like to split byte strings, for example "AAFF10DC", with spaces, so it becomes "AA FF 10 DC". How to do this in AutoIt (v3)? ...

jQuery/javascript delete suffix of variable

I have a variable set to retrieve the id of a specific element which is "PubRecNum-1" (the number is also variable and will change depending on the record number). What I'm needing is a way to only take the first 3 letters of the variable "Pub" (needed for comparison purposes). Any ideas? ...

c++ new & delete and string & functions

Okay the previous question was answered clearly, but i found out another problem. What if i do: char *test(int ran){ char *ret = new char[ran]; // process... return ret; } And then run it: for(int i = 0; i < 100000000; i++){ string str = test(rand()%10000000+10000000); // process... // no need to delete...

Assigning a string to a 2D array

char in[100], *temp[10],var[10][10]; int i, n = 0, double val[10]; var[0][]="ANS"; I want to assign a string to var[0][0,1,2] which is 'ANS', but does not work and i cannot figure where i am wrong about this ...

Mistake in the Asc() VB function?

Hello! Could you please tell why the Asc() function returns incorrect result? Dim TestChar = Chr(128) Dim CharInt = Asc(TestChar) ' this is a mistake on Windows 7 x64. Asc(TestChar) returns 136 instead of 128 I executed this code on another computer and the result was 128. Thanks. ...

Obj-C: Creating an object with a String name

Hey all. I know this sounds simple, but I can't find a way to do it. I have a method in Obj-C that takes in a NSString and then should create a new class with the String as its title. -(DataModel *)createDataModel:(NSString *)dataModel_name { DataModel *[initWithString:dataModel_name] = [[DataModel alloc] init]; } I ...

Perl, evaluate string lazily

Consider the following Perl code. #!/usr/bin/perl use strict; use warnings; $b="1"; my $a="${b}"; $b="2"; print $a; The script obviously outputs 1. I would like it to be whatever the current value of $b is. What would be the smartest way in Perl to achieve lazy evaluation like this? I would like the ${b} to remain "unreplaced" ...

from string of bytes to OpenCV's IplImage in Python?

Hey all, I am streaming some data down from a webcam. When I get all of the bytes for a full image (in a string called byteString) I want to display the image using OpenCV. Done fast enough, this will "stream" video from the webcam to an OpenCV window. Here's what I've done to set up the window: cvNamedWindow('name of window', CV_WIND...

Vb.net Custom Class Property to lower case

I am trying to create a settings class. The Property Test() is a list of strings. When I add a string such as: t.test.Add("asasasAAAAA") I want it to autmatically turn lowercase. For some reason it is not. Any Ideas? p.s. using t.test.Add(("asasasAAAAA").ToLower) will not work for what I need. Thank you. Public Class Form1 Priv...

string count with overlapping occurances

What's the best way to count the number of occurrences of a given string, including overlap in python? is it the most obvious way: def function(string, str_to_search_for): count = 0 for x in xrange(len(string) - len(str_to_search_for) + 1): if string[x:x+len(str_to_search_for)] == str_to_search_for: ...

C#: Why only integral enums?

I've been writing C# for seven years now, and I keep wondering, why do enums have to be of an integral type? Wouldn't it be nice to do something like: enum ErrorMessage { NotFound: "Could not find", BadRequest: "Malformed request" } Is this a language design choice, or are there fundamental incompatibilities on a compiler,...

BNF to handle escape sequence

I use this BNF to parser my script: ` {identset} = {ASCII} - {"\{\}}; //<--all ascii charset except '\"' '{' and '}' {strset} = {ASCII} - {"}; ident = {identset}*; str = {strset}*; node ::= ident "{" nodes "}" | //<--entry point "\"" str "\"" | ident; nodes ::= node nodes | ...

How to store string matrix and write to a file?

I don't know if Matlab can do this, but I want to store some strings in a 4×3 matrix, each element in the matrix is a string. test_string_01 test_string_02 test_string_03 test_string_04 test_string_05 test_string_06 test_string_07 test_string_08 test_string_09 test_string_10 test_string_11 test_string_12 Then, I want to write ...

String, StringBuffer, and StringBuilder

Please tell me a real time situation to compare String, StringBuffer, and StringBuilder? ...

Searching NSString in XML database, Iphone

My project is like a classifieds kind of stuff.. I have a search text box in the first page. When the user enters some text in that, i need to compare that text to the XML file from where all the data are being recieved, and should list out all the advertisements in the Table View (next page).. I had did this kind of search in sql dat...

Optimizing a lot of Scanner.findWithinHorizon(pattern, 0) calls

I'm building a process which extracts data from 6 csv-style files and two poorly laid out .txt reports and builds output CSVs, and I'm fully aware that there's going to be some overhead searching through all that whitespace thousands of times, but I never anticipated converting about 50,000 records would take 12 hours. Excerpt of my ma...

Tokenize problem in Java with separator ". "

I need to split a text using the separator ". ". For example I want this string : Washington is the U.S Capital. Barack is living there. To be cut into two parts: Washington is the U.S Capital. Barack is living there. Here is my code : // Initialize the tokenizer StringTokenizer tokenizer = new StringTokenizer("Washington is the ...

elaborate urls with regex

i have a string that maybe contains text with links. I use these instructions for elaborate it: message = message.gsub(/http[s]?:\/\/[^\s]+/) do |m| replace_url(m) end if the string is "http://www.youtube.com/watch?v=6zToqLlM8ms&amp;amp;playnext_from=TL&amp;videos=qpCvM5Ocr3M&amp;feature=sub" the instructions works. b...