I would like to have a string (char*) parsed into a tm struct in C. Is there any built-in function to do that?
I am referring to ANSI C in C99 Standard.
I can use __LINE__ as a method parameter just fine, but I would like an easy way to use it in a function that uses strings.
For instance say I have this:
11 string myTest()
12 {
13 if(!testCondition)
14 return logError("testcondition failed");
15 }
And I want the result of the function to be:
"myTest line 14: testcondition failed"
How can I write logError? Does it have to be some monstrosity of a macro?
given an xml string like this:
<some><nested><xml>value</xml></nested></some>
what's the best option (using ruby) to format it into something readable like:
<some>
<nested>
<xml>value</xml>
</nested>
</some>
I was wonding if there was an alternative to itoa() for converting an integer to a string because when I run it in visual Studio I get warnings, and when I compile my program under Linux, it won't even compile.
Thanks,
tomek
how to pass string to a url in java. i want to download an image from a web server. before downloading a image i want to pass some values to that image then after that i want to download the image. can someone help me. in Java SE application
My string looks like:
$fullPath = $dirName . "/" . $file;
If I replace / with \, it gives error: "Expecting identifier or variable". I want to store in the latter way itself. How to override anything coming in between?
I've noticed that if you sent a query string routevalue through asp.net mvc you end up with all whitespaces urlencoded into "%20". What is the best way of overriding this formatting as I would like whitespace to be converted into the "+" sign?
I was thinking of perhaps using a custom Route object or a class that derives from IRouteHandler but would appreciate any advice you might have.
I'm parsing some code and want to match the doxygen comments before a function. However, because I want to match for a specific function name, getting only the immediately previous comment is giving me problems.
Is there a way to search backward through a string using the Python Regex library?
Is there a better (easier) approach that I'm missing?
I have a method which has domain name as a String parameter.
def modelName="Equity"
I want to use it like
def results=modelName.findAll()
Please guide me!
Hi there,
I'm using Visual Studio 2005 and have a DataTable with two columns and some rows that I want to output to the console. I hoped there would be something like:
DataTable results = MyMethod.GetResults();
Console.WriteLine (results.ToString());
What's the best way (i.e. least amount of coding from me) to convert a simple DataTable to a string?
Thanks,
Mark.
while xml parsing, i have a string value like this :
android & iphone
but my parsed value(output what i am getting) is just:
android
then i used the normalize method it comes :
android iphone
But i need a output like:
android & iphone
How to do that? Any Idea?
Example: I want to do this:
METHODNAME(5) {
// do something
}
which results in:
- (void)animationStep5 {
// do something
}
Is there any way to do this? Basically, what I need is a way to generate a real source code string before the program is compiled, so the compiler does see - (void)animationStep5...
Or maybe there's something different than a macro, which can help here to auto-generate method names (not at run-time)?
Definition:
A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction
How to check if the given string is a palindrome?
This was one of the FAIQ [Frequently Asked Interview Question] a while ago but that mostly using C.
Looking for solutions in any and all languages possible.
In Perl, I would write:
$x = "abbbc";
$x =~ s/(b+)/z/;
print "Replaced $1 and ended up with $x\n";
# "Replaced bbb and ended up with azc"
How do I do this in Python -- do a regular-expression string replacement and record what it was that got replaced?
int i = 4;
string text = "Player ";
cout << (text + i);
I'd like it to cout "Player 4"
^ The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?
I'm reading a comma-delimited list of strings from a config file. I need to check whether another string is in that list. For example:
"apple,banana,cheese"
If I check for "apple" I should find it, but if I check for "app" I should not.
What's the most straight-forward and concise way to do this? It doesn't have to be fast.
(I'll add my solution as an answer, but I'm hoping someone has something better.)
Some app is hitting my site excessively from GAE. Here is the browser string in the logs:
AppEngine-Google; (+http://code.google.com/appengine; appid: ware)
Can that app be identified ? "appid" would seem to indicate this but it doesn't seem to be the case.
i have a string like this
"o1 1232.5467 1232.5467 1232.5467 1232.5467 1232.5467 1232.5467"
how do i extract only "o1 1232.5467"
the no.of characters to be extracted are not the same always..hence i want to extract until second space is encountered..plz help..
Let's say using Javascript, I want to match a string that ends with [abcde] but not with abc.
So the regex should match xxxa, xxxbc, xxxabd but not xxxabc.
I am utterly confused.
How can I convert a JSON string to an object in JavaScript? Is there a method that does this?
Something like:
var x = "{ id: 5, name: 'hello' }";
var y = /*something*/(x);
alert(y.id + " " + y.name);