string

Would the javascript .split(' ') leave the commas in the array?

I have a space separated string that I want to make into an array. I am using the .split(' ') method to do this. Will the resulting array have those spaces in it? For example if my string is "joe walked down the street" and I performed the method on it would the array look like this ["joe", "walked", "down", "the", "street"] or will it l...

string::c_str query

Where does the pointer returned by calling string::c_str() point to ? In the following code snippet, I thought I will give get a segmentation fault but it gives me the correct output. If the pointer returned by string::c_str() points to an internal location inside the string object, then when the function returns and the object destructo...

How do I check for if an exact string exists in another string?

I'm currently running into a bit of a problem. I'm trying to write a program that will highlight occurrences of a word or phrase inside of another string, but only if the string it's being matched to is exactly the same. The part I'm running into troubles with is identifying whether or not the subphrase I'm matching the phrase with is co...

C4503 warnings? How do i solve/get rid of them?

Hi, It's my first time trying out C++ STL. I'm trying to build a multidimensional associative array using map. For example: typedef struct DA { string read_mode; string data_type; void *pValue; void *pVarMemLoc; }DA; int main() { map<string, map<string, map<string, map<string, map<string, DA*>>>>> DATA; ...

Can make STL string::c_str() return NULL when it has no string?

My project has legacy library which consider NULL pointer as empty string. But when I get return data from std::wstring like this, std::wstring strData; const wchar* pStr = strData.c_str(); ASSERT(NULL == pStr); // ASSERT!! pStr is not NULL but pointer which wstring point. Can I make std::string return NULL when it has no string da...

java string base64 encoded

I need a way to know if a string is Base64 encoded... any idea ? thanks ...

Python - Stripping timestamps and username from line in file

I'm writing a script that will print a random line of text from a file into an XCHAT channel. So far it works fine, but I want to add one last bit of functionality. I have logs with, for example, "Oct 23 12:07:59 (nickname> " appearing before every line of text. I just want to print the parts of the lines that follow the "(nickname>...

plsql query return result into single row as concat

select col1 from tablename returns 2 rows, i want to concat thse two rows data into single column as comma separated. ...

comparing string values

I want to compare 2 strings. My first value is in 'list[0][0]' variable and the second value is in item[0]. But when I am comparing the 2 strings using 'if' statement, I don't get the answer. if(selected_list[0][0]==items[0]) { // some code } it is not working. But when I am hard-coded these values, it is working fine. if("banana"=="ban...

mysql order by integer and varchar

I got a field with sizes(VARCHAR). The sizes can have int and string values, e.g. (1, 2, 3-4, X, XL, M, ...). When i use the normal order by function of mysql the output is the following: 1,10,11,2, 44-46, L, M, S, XL, XXL The values that does not contain a number are sorted as i want to do it. (I know that the values are sorted as a str...

What is the default encoding for C strings?

I know that C strings are char[] with a '\0' in the last element. But how are the chars encoded? Update: I found this cool link which talks about many other programming languages and their encoding conventions: Link ...

ListView using String Array

How can I give values to ListView? When I am trying to create a ListView using String array, my process is suddently stopped. public String[] items_list=new String[100]; items_list[0]="11"; items_list[1]="22"; items_list[2]="33"; items_list[3]="44"; ListView listitems=(ListView)findViewById(R.id.list); ...

How to convert a string into array in delphi ?

Dear experts: In php and java there are explode and tokenizer function to convert a string into array without punctuations. Are are functions or some way in delphi to do the work. Suppose there is a large file " This is, a large file with punctuations,, and spaces and numbers 123..." How can we get array "This is a large file with punct...

Convert string to Date - C#

How would I be able to convert a string like "On Monday 25th March 2010..." to 25/03/10? Also, is this possible? ...

How can I find the starting index of a string within a UTF-8 byte array? (C#)

I have a UTF-8 byte array of data. I would like to search for a specific string in the array of bytes in C#. byte[] dataArray = (some UTF-8 byte array of data); string searchString = "Hello"; How do I find the first occurrence of the word "Hello" in the array dataArray and return an index location where the string begins (where the 'H...

How to get XmlSchema object from XSD which is string in C#?

How to get XmlSchema object from large string that contains all Xsd content? Thanks. ...

Is it possible to concatenate heredoc string in PHP..?

With normal PHP string you can do this: $str = "Hello "; $str .= "world"; $str .= "bla bla bla"; $str .= "bla bla bla..."; But can you do the same with heredoc string..? $str = <<<EOD Hello world EOD; $str .= <<<EOD bla bla bla"; bla bla bla..."; EOD; ...

Parsing csv file with commas and quotes as deliminators Pin

So Im reading a csv file and splitting the string with "," as the deliminator but some of them have quotes as to not split the specific field because it has a comma in it. 1530,Pasadena CA,"2008, 05/01","2005, 12/14" with just comma it would be: 1530 Pasadena CA "2008 05/01" "2005 12/14" I need it to take commas into consideration w...

using Python to generate a C string literal of JSON

I have a dictionary in Python that I would like to serialize in JSON and convert to a proper C string so that it contains a valid JSON string that corresponds to my input dictionary. I'm using the result to autogenerate a line in a C source file. Got it? Here's an example: >>> import json >>> mydict = {'a':1, 'b': 'a string with "quotes...

using malloc() for double pointers

Hi there, a malloc question. First, I generate some strings. And second, I allocate none-space for copying pointers which point to those strings. At this moment the program should probably crash, since I ve tried to copy those pointers to nowhere, but it doesn’t crash. How is it possible? Any comments would be appreciated. #include <...