string

how to execute an for loop till the queue is emptyin c++

hello, i need to execute an for loop till the queue is empty my code queue<string> q; for(int i=0;i<q.size(),i++) { // some operation goes here // some datas are added to queue } ...

Java string search

Hi, If I am looking for a particular word inside a string, for example, in the string "how are you" I am looking for "are". Would a regular indexOf() work faster and better or a Regex match() String testStr = "how are you"; String lookUp = "are"; //METHOD1 if (testStr.indexOf(lookUp) != -1) { System.out.println("Found!"); } //OR //...

How to convert the a java type to java string []?

I want to ask a Java String[] question. In the java, if a variable convents to another, it can add the (String), (int), (double),... before the variable in the left hand side. However, is there something like (String[]) in Java as I want to convent the variable into (String[]). ...

How to convert the Object[] to String[] in Java?

Hi, everyone, I have a question about Java. I have an Object[] (Java default, not the user-defined) and I want to convert it to a String[]. Can anyone help me? thank you. ...

split string with more than one Char in C#

i want to split the String = "Asaf_ER_Army" by the "ER" seperator. the Split function of String doesn't allow to split the string by more than one char. how can i split a string by a 'more than one char' seperator? ...

Removing extra commas from string after using String.Join to convert array to string (C#)

Quick question here. I'm converting an array into a string using String.Join. A small issue I have is that, in the array some index positions will be blank. An example is below: array[1] = "Firstcolumn" array[3] = "Thirdcolumn" By using String.Join(",", array);, I'll get the following: Firstcolumn,,Thirdcolumn Note the extra ,. ...

Replace\remove character in string

Hello, string DelStr = "I! am! bored!"; string RepStr = "10/07/10" I want to delete all '!' on DelStr and I want to replace all '/' with '-' on the RepStr string. Is there any way to do this without doing a loop to go through each character? ...

Getting rid of \x## in strings (Python)

I need to extract a description from a file, which looks like this: "TES4!\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00HEDR\x0c\x00\xd7\xa3p?h\x03\x00\x00\x00\x08\x00\xffCNAM\t\x00Martigen\x00SNAM\xaf\x00Mart's Mutant Mod - RC4\n\nDiverse creatures & NPCs, new creatures & NPCs, dynamic size and stat scaling...

PHP: htmlentities not working with variable

Hey, I'm using htmlentities() to convert characters like Ç and ® to its character codes. I'm getting the texts from the MYSQL database. while($row = mysql_fetch_array($array, MYSQL_NUM)){ echo "<div style='float:left; margin-right:40px;'> <div style='width:148px; height:141px; background-image:url(uploads/".$row[0].")'> <img src...

How to convert DetailsView columns to uppercase

Hi all, I need to be able to convert all input fields in a DetailsView (Insert) to uppercase. How do I do this? My SQL query and the whole insert statement takes place in ASP.NET, and not in code behind so I'm not sure if I can dynamically do this in ASP. I've used Text-Transform in CSS to make them look uppercase for the user, but it s...

Converting newlines to spaces in Latex

I'm writing a document and I have a few chapter titles that I would like to appear as 2 lines for a chapter title, but only one line in the table of contents. Is there a simple command I to filter out the newline character like this? Chapter Title First Line: Second more informative line ToC: First Line: Second more infor...

How to: remove part of a Unicode string in Python following a special character

Hi all first a short summery: python ver: 3.1 system: Linux (Ubuntu) I am trying to do some data retrieval through Python and BeautifulSoup. Unfortunately some of the tables I am trying to process contains cells where the following text string exists: 789.82 ± 10.28 For this i to work i need two things: How do i handle "weird" sym...

How do you split a string into word pairs [php]?

I am trying to split a string into an array of word pairs in PHP. So for example if you have the input string: "split this string into word pairs please" the output array should look like Array ( [0] => split this [1] => this string [2] => string into [3] => into word [4] => word pairs [5] => pairs please ...

How to convert a String to an android.net.Uri

Question: I have found that java.net.URI has a create(String uri) option but the android.net.uri does not. More Specific: I am trying to grab the output of RingtoneManager's RingtonePicker and set it as the default ringtone with SetActualDefaultRingtoneUri; Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER); intent.pu...

String comparison and String interning in Java

When should one compare Strings as objects and when should one use their equals method? To make sure, I always use equals, but that doesn't seem very efficient. In what situations can I be certain that string1 == string2 is a safe to use? Thanks! ...

Storing a PHP loop as a string in a variable

Hello! I have a problem storing a PHP loop in a variable. The loop is like this: for( $i = 1; $i <= 10; $i++ ) { echo $i . ' - '; } for this it's OK for an echo or print as it will produce: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - now I want to store the whole loop in a variable like $my_var which means: echo $my_var; ...

Object name from String in Objective-C

Hi, i want to set the name of an object like UIButton from a string. NSString *string = [[NSString alloc] initWithString:@"someString"]; UIButton *(string) = [[UIButton buttonWithType:UIButtonTypeCustom]retain]; My goal is: UIButton *someString = [[UIButton buttonWithType:UIButtonTypeCustom]retain]; how can i solve this? ...

Please help in strtok()

Please explain me the working of strtok() function.The manual says it breaks the string into tokens. I am unable to understand from the manual what actually it does. I added watches on str and *pch to check its working, when the first while loop occurred, the contents of str were only "this". How did the output shown below printed on th...

C++ and Embedded Python - NUL Terminated Strings

I'm working on embedding Python 2.6 into an existing c++ application. So far I have the Libraries linked in and am able to successfully initialize the Python Interpreter and can also transfer data to Python. I'm having trouble retrieving it, and hope someone can steer me the right direction. I'm working with this: Py_Initialize(); p...

Escaping arguments for string.Format in a C# multiline verbatim string

string template = @" { argument1 = ""{0}""; argument2 = {1}; }"; When I format it as a usual string with string.Format, naturally i get an exception that the input string was not in correct format. I tried escaping the arguments as it is recommended in msdn documentation, like "{{0}...