I have time from DB:
string user_time = "17:10:03"; //Hours:minutes:seconds
DateTime time_now = DateTime.Now;
How do I compare the time? How make same like this:
if(time_now > user_time)
{
//Do something
}
else
{
//Do something
}
How can I split a string only once, i.e. make "1|Ceci n'est pas une pipe: | Oui" parse to: ["1", "Ceci n'est pas une pipe: | Oui"]?
The limit in split doesn't seem to help...
How can I instantiate an anonymous object while passing the propertynames and values as string?
new With { .SomeProperty = "Value" }
new With { ".SomeProperty" = "Value" } //something like this? :)
I am using spring mvc in which i convert the arraylist into json string. I have one object 1) results.
My output from spring looks like this:
{
"data":"[{\"userName\":\"test1\",\"firstName\":\"test\",\"lastName\":\"user\"}, {\"userName\":\"test2\",\"firstName\":\"test1\",\"lastName\":\"user1\"}]",
}
I get output as null when i do '$.parseJSON' with this output. When i tried testing only with data object it works fine
Any help would be great.
Is there any way to create a hash of string at compile time using the C/C++ preprocessor (or even template-metaprogramming)?
e.g. UNIQUE_SALT("HelloWord", 3DES);
The idea is that HelloWorld will not be present in the compiled binary, just a hash.
Given a string named line whose raw version has this value:
\rRAWSTRING
how can I detect if it has the escape character \r? What I've tried is:
if repr(line).startswith('\r'):
blah...
but it doesn't catch it. I also tried find, such as:
if repr(line).find('\r') != -1:
blah
doesn't work either. What am I missing?
thx!
In my code I need to compare string letters but my problem is that lower case letters are greater than upper case letter.
For example Z < a.
How could I implement this in my code ?
Thanks
Hello,
I want to know how to echo a string that have a $ sign from a database. At this time, the value on database 'Buy one for $5.00' converts to 'Buy one for .00'.
Ex:- Field: title | Value: Buy one for $5.00
<?php
$row = mysql_fetch_array.....
$title = $row['title'];
echo $title;
?>
Thank you, pnm123
How to Find more than one string with Excel with the graphical interface?
For example, I am looking for the cells which is contained both strings Paul and John?
Hi all,
i have a little question ,i have a NSString object
(\n "1 Infinite Loop",\n "Cupertino, CA 95014",\n USA\n)
and i want the Cupertino from this string
Till now i have used stringByReplacingOccurrencesOfString: and able to get "1InfiniteLoop""CupertinoCA95014"USA
But still not able get Cupertino.
Do any other method able to solve this problem?
Hi. Is there a way to convert '@my_variable' string into a value of @my_variable?
I have a table which stores names of variables. I need to get the value of this variable. Something like this:
DECLARE @second_variable AS NVARCHAR(20);
DECLARE @first_variable AS NVARCHAR(20);
SET @first_variable = '20';
SET @second_variable = SELECT '@first_variable'; --here I want that @second variable be assigned a value of "20".
I want to sort a list of strings based on the string length. I tried to use sort as follows, but it doesn't seem to give me correct result.
xs = ['dddd','a','bb','ccc']
print xs
xs.sort(lambda x,y: len(x) < len(y))
print xs
['dddd', 'a', 'bb', 'ccc']
['dddd', 'a', 'bb', 'ccc']
What might be wrong?
HI,
I have a string:
NEW ALPINESTAR?S SMX PLUS WHITE
MOTORCYCLE BOOTS! 44/9.5$349.95 Time
Left 1h 2m NEW AGV BLADE FLAT MATTE
WHITE LARGE/LG HELMET$75.53Time Left
1h 2m
I want result in array like this:
Productname
Price time NEW ALPINESTAR?S SMX
PLUS WHITE MOTORCYCLE BOOTS! 44/9.5
$349.95 Time Left 1h 2m
Hi All,
here is me requirement.
I have one text file and I need to get exact specified string from that file
C:>type small.txt | find "small2"
small2
small22
small20
C:>type small.txt small2
small22
small20
C:>type small.txt | find "small2" small2
small22
small20
C:\
Here it is giving all the words instead of only "small2"
Plz help me in this.. it's urgent
Thanks in advance
I have a string like so:
option_alpha="value" option_beta="some other value" option_gamma="X" ...etc.
I'm using this to parse them into name & value pairs:
preg_match_all("/([a-z0-9_]+)\s*=\s*[\"\'](.+?)[\"\']/is", $var_string, $matches)
Which works fine, unless it encounters an empty attribute value:
option_alpha="value" option_beta="" option_gamma="X"
What have I done wrong in my regex?
Hi, I have a string and I want to check if it represents a proper namespace, eg. System.IO is ok, but System.Lol is not.
I guess some reflection should be used, but I can't figure this out.
Any thoughts?
If I have 5 String variables and between 0 and 5 of them are null or empty is there an easy/short way of returning the first one that is not null or empty? I am using .NET 3.5
I need to be able to call a function, but the function name is stored in a variable, is this possible. e.g:
public void foo ()
{
//code here
}
public void bar ()
{
//code here
}
String functionName = "foo";
// i need to call the function based on what is functionName
Anyhelp would be great, thanks
How can i pass a string delimited by space or comma to stored procedure and filter result?
I'm trying to do something like -
Parameter Value
--------------------------
@keywords key1 key2 key3
Then is stored procedure i want to first
find all records with first or last
name like key1
filter step 1 with first or last
name like key2
filter step 2 with first or last name like key 3
I have a question about converting types. I want to change the currently selected combobox value string to an int, but I get errors
My code:
int.Parse(age.SelectedItem.ToString());
What can I do for this problem?
Hi,
I'm currently integrating facebook into my current app and I've succeeded in retrieving the access_token using the following code:
url="#{url}?#{client_id}&#{client_secret}&#{code}&#{redirect_uri}&type=client_cred"
agent = Mechanize.new
page = agent.get(url)
The page object above has a body which contains text something along the lines of
access_token=XXXXX
I just want to pull out the access_token value. I can get the entire string simply by writing:
page.body
But I was wondering is there a way to get the access_token value without resorting to regular expressions etc?
Thanks.
i am trying to store large data more than 255 characters in a string datatype but it truncates after 255. how can i achive this basically i need to pass this data to database