string

std string problem with libcurl - c++

I'm pretty new to c++ and I'm using libcurl to make an http request and get back a string with the respond's content. size_t write_to_string(void *ptr, size_t size, size_t count, void *stream) { ((std::string*)stream)->append((char*)ptr, 0, size*count); return size*count; } int main(void) { CURL *curl; CURLcode res; ...

Selecting string/literal from a specified child node element using XSLT

this is the excerpt of the XML file. <rdf:RDF> <rdf:Description rdf:about="http://abc.org/JohnD"&gt; <video:Movie xml:lang="en" xmlns:video="http://example.org/movie"&gt;Avatar&lt;/video:Movie&gt; </rdf:Description> <rdf:Description rdf:about="http://abc.org/JohnD"&gt; <foaf:interest xml:lan...

Android: parameters in strings.xml possible?

Hello Folks In my android app i'am going to implement my strings with Internationalization. So currently i got a problem with the grammar and the way sentences build in different languages. For example: "5 minutes ago" - english "vor 5 Minuten" - german So my first question is, can i do smth like this in strings.xml: <stri...

How to convert a double to a string without using the CRT

Hi everybody. My question has no practical application. I'm just interested. Suppose, I have a double value and I want to obtain its string representation similarly to the printf function. How would I do that without the C runtime library? Let's suppose I'm on the x86 architecture. ...

Wind blowing on String

I have some basic idea on how to do this task, but I'm not sure if I'm doing it right. So we have class WindyString with metod blow. After using it : System.out.println(WindyString.blow( "Abrakadabra! The second chance to pass has already BEGUN! ")); we should obtain something like this : e ...

Java string searching ignoring accents

I am trying to write a filter function for my application that will take an input string and filter out all objects that don't match the given input in some way. The easiest way to do this would be to use String's contains method, i.e. just check if the object (the String variable in the object) contains the string specified in the filt...

Python, print delimited list

Consider this Python code for printing a list of comma separated values for element in list: print element + ",", What is the preferred method for printing such that a comma does not appear if element is the final element in the list. ex a = [1, 2, 3] for element in a print str(element) +",", output 1,2,3, desired 1,2,3 ...

String vectors not working as expected with newline and iterators? (C++)

I have a text file made of 3 lines: Line 1 Line 3 (Line 1, a blank line, and Line 3) vector<string> text; vector<string>::iterator it; ifstream file("test.txt"); string str; while (getline(file, str)) { if (str.length() == 0) str = "\n"; // since getline discards the newline character, replacing blank strings with newline ...

Quick question regarding this issue, Why doesnt it print out the second value(converted second value) on the string?

Quick question, What have I done wrong here. The purpose of this code is to get the input into a string, the input being "12 34", with a space in between the "12" and "32" and to convert and print the two separate numbers from an integer variable known as number. Why doesn't the second call to the function copyTemp, not produce the value...

Conversion from string to wstring is causing ú to lose encoding

The variable filepath which is a string contains the value Música. I have the following code: wstring fp(filepath.length(), L' '); copy(filepath.begin(), filepath.end(), fp.begin()); fp then contains the value M?sica. How do I convert filepath to fp without losing the encoding for the ú character? ...

GetDate in a string in c#

Hi, I'm having some trouble using regular expression to get date in a string. Example : string text = "75000+ Sept.-Oct. 2004"; MatchCollection dates = Regex.Matches(text, @"[0-9]{5,}[+][\s](jan|feb|fev|mar|apr|avr|may|mai|jun|jui|jul|jui|aug|aoû|sept|oct|nov|dec)[\.][\-](jan|feb|fev|mar|apr|avr|may|mai|jun|jui|jul|jui|aug|aoû|sept|...

Named string format

This questing has been asked some time ago, here and here and also blogged about. It all seemed a bit experimental at the time. So now some time afterwards, I would like to hear if you use any of the methods in production? ...

Split comma-separated parameters in LaTeX

I am trying to build a command which is similar to LaTeX \cite{}, which accepts a comma-separated list of parameters like this \cite{Wall91, Schwartz93} I would like to pass each item in the comma-separated list which the parameter represents to another command and return the concatenation of the individual results. I imagine it to be ...

How to change String value comparison

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 ...

substring with linq??

I've got collection of words, and i wanna create collection from this collection limited to 5 chars Input: Car Collection Limited stackoverflow Output: car colle limit stack word.Substring(0,5) throws exception (length) word.Take(10) is not good idea, too... Any good ideas ?? ...

Help with function in string

I have a variable, emailBody, which is set to a string stored in a database. The email body is set to a string via a dlookup function. emailBody = DLookup("emailBody", "listAdditions", "Id = " & itemType) The string that email body is set to includes an IIf function (which includes a dlookup function). When ?emailBody is entered in...

String.Format Phone Numbers with Extension

I am trying to create a an function that formats US phone numbers -- hopefully without looping through each digit. When 10 digits are passed in all is fine. How ever when more than 10 digits are passed in I want the String.Format method to append the extension digits on the right. For example: When 14 digits passed in the result shoul...

ruby nl2br outside <code> ... </code>

Hi everyone, I've been struggling on this thing for a week without being able to find what I'm looking for. Here is what I'd like to do: I'm setting up a wiki where I can post all my knowledge to (yes, I know a couple things :p) but I can't render it the way I'd like to. The bodies of my posts are text fields. In order to render them t...

Is there any legitimate use for bare strings in PHP?

This question got me thinking about bare strings. When PHP sees a string that's not enclosed in quotes, it first checks to see if it's a constant. If not, it just assumes it's a string and goes on anyway. So for example if I have echo $foo[bar]; If there's a constant called bar it uses that for the array key, but if not then it treat...

How do I escape a string in Java?

I'm reading a sourcefile in Java, but when I print it (sysout), the escaped characters are no longer escaped. How can I escape characters like \n and \t in a string in Java? ...