string

String format options for int in .NET

I want to convert an int to a string but if it is a single digit I want to add a leading 0 Is that one of the built in format options? or do I have to do it manually? ...

c++ address string -> long

I got an adress example: 0x003533 , its a string but to use it i need it to be a LONG but i dont know how to do it :S has anybody a solution? so string: "0x003533" to long 0x003533 ?? ...

String Concatenation Issue

Hi, Could you please have a look at my code below. #!C:\Perl\bin\perl.exe use strict; use warnings; use Data::Dumper; my $fh = \*DATA; my $str1 = "listBox1.Items.Add(\""; my $str2 = "\")\;"; while(my $line = <$fh>) { $line=~s/^\s+//g; print $str1.$line.$str2; chomp($line); } __DATA__ Hello World Output: D...

How to read and write a STL C++ string?

#include<string> ... string in; //How do I store a string from stdin to in? // //gets(in) - 16 cannot convert `std::string' to `char*' for argument `1' to //char* gets (char*)' // //scanf("%s",in) also gives some weird error Similarly, how do I write out in to stdout or to a file?? ...

Find all possible combinations of string with mysql

Is it possible to use mysql to search for the word "arsech" and find the word "Search" (if it is in the database)? ...

Changing text depending on rounded total from database

On a website I have a number of small PHP scripts to automate changes to the text of the site, depending on a figure that's calculated from a MySQL database. The site is for a fundraising group, and the text in question on the home page gives the total amount raised. The amount raised is pulled from the database and rounded to the neare...

permutations gone wrong

I have written code to implement an algorithm I found on string permutations. What I have is an arraylist of words ( up to 200) and I need to permutate the list in levels of 5. Basically group the string words in fives and permutated them. What I have takes the first 5 words generates the permutations and ignores the rest of the arraylis...

how to replace quotation marks with \"

hello. im trying to echo mediaplayer embed code with IF statement. is there any way to replace all quotation marks (") with (\")'s ? thank you.. ...

split html text in 2 paragraphs

hi i have a html text like this: aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa aa</a> adsfsadfsadfs i want to split it in 2 paragraphs. but i don't want to generate this situation: <p>aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa</p><p> aa</a> adsfsadfsadfs</p> how can i check if the split involves any tags and av...

Best way to get ints from a string with whitespace?

Hey all, I know this is simple, I just can't recall the best way to do this. I have an input like " 5 15 " that defines the x and y of a 2D vector array. I simply need those two numbers into int col and int row. What's the best way to do this? I was attemping stringstreams, but can't figure out the correct code. Thanks for any help! ...

How can I return to a string address and then assign it to a new string?

I have 1 function that I want to return the address of an assigned string to the main function and assign an new string pointer with the same address so that the new string will have the contents of the old string. For example: unknown_datatype function() { char *old = "THE STRING"; return old; } int main() { ch...

Why did this work with Visual C++, but not with gcc?

I've been working on a senior project for the last several months now, and a major sticking point in our team's development process has been dealing wtih rifts between Visual-C++ and gcc. (Yes, I know we all should have had the same development environment.) Things are about finished up at this point, but I ran into a moderate bug just t...

How to check if a position inside a std string exists ?? (c++)

Hello, i have a long string variable and i want to search in it for specific words and limit text according to thoses words. Say i have the following text : "This amazing new wearable audio solution features a working speaker embedded into the front of the shirt and can play music or sound effects appropriate for any situation. It's j...

Why I can't substitute with '\\+' inside a string with gsub?

Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts s.gsub('#value#', Regexp.escape('+')) # => '' Wtf? It looks like the char '\+' (returned by Regexp.escape) is completely ignored by gsub. How to fix this? ...

has any method like substitute of mootools in jquery ..

this is mootools code: var myString = "{subject} is {property_1} and {property_2}."; var myObject = {subject: 'Jack Bauer', property_1: 'our lord', property_2: 'savior'}; myString.substitute(myObject); and does jquery has this mothod? or like this method ? ...

how to replace specific strings in HTML docs or specific elements ?

How can I parse a html document or just a html element in order to replace all specific strings into other ones ? In other terms: - search for all strings #### in element .class - replace them with $$$$$ I'm using jQuery.. thanks ...

Display part of an XML file while parsing it

Hey, Consider the following XML file : <cookbook> <recipe xml:id="MushroomSoup"> <title>Quick and Easy Mushroom Soup</title> <ingredient name="Fresh mushrooms" quantity="7" unit="pieces"/> <ingredient name="Garlic" quantity="1" unit="cloves"/> </recipe> <recipe...

Python slicing a string using space characters and a maximum length

I'd like to slice a string up in a similar way to .split() (so resulting in a list) but in a more intelligent way: I'd like it to split it into chunks that are up to 15 characters, but are not split mid word so: string = 'A string with words' [splitting process takes place] list = ('A string with','words') The string in this example...

Split a string in ESQL

Do we have a inbult esql function to split a string ? ...

adapting combination code for larger list

I have the following code to generate combinations of string for a small list and would like to adapt this for a large list of over 300 string words.Can anyone suggest how to alter this code or to use a different method. Public Class combinations Public Shared Sub main() Dim myAnimals As String = "cat dog horse ape hen mouse" ...