string

Asp.net String filtering issues

I have two different asp.net web pages with gridviews. They both display numerical data as currency. One page displays the currency with the '£' symbol. Its code is as follows: <asp:Label ID="Total" runat="server" Text='<%# Eval("TotalCharges", "{0:lc}") %>'></asp:Label> The other page displays its data with a $. Here is its code:...

how do you convert a double to a string?

I know that most programming languages have functions built in for doing that for you, but how do those functions work? ...

print a string in an external application (python 3.1)

Suppose I have a game and a python script running. In this game, to speak you just type whatever you want and hit enter. This python script has a button on it that I want to output a predefined string into the game, and hit enter automatically (essentially, the button causes the character to speak the string). What would be the easiest w...

How to generate all possibilities of a string with X tokens and Y values for each token

So, I have a template string with X amount of tokens in it. Hypothetically it could look like this: template = "render=@layer0@-@layer1@-@layer2@-@layer3@-@layer4@" The tokens, obviously, take the form of @tokenname@. In this hypothetical case it has five tokens. Each token has a different set of possible values. For example: token0V...

Converting TextView to String (kind of) Android

I have an object on my main.xml layout file called thefact that is TextView. I also have a string called sharefact. I want to save what text is in the TextView into the sharefact string. I can't do: sharefact = thefact Or anything similar to that because it would want me to convert sharefact into a textview. Thanks! ...

String Comparison with a Format - Python

I wanted to check if user has entered the input in particular order or not. Basically i wanted user to input date in format like this %d/%m/%y %H:%M Is there any way i can compare string input with the above format in python? ...

preg_replace and date

I want to remove all - and / characters in a date string. Can someone give me a hand? Here is what I have but it doesn't work. preg_replace('/','',$date); preg_replace('-','',$date); Also, is there a way to group these two expressions together so I don't have to have 2 preg_replaces? ...

Sort an array of char in C

I have been struggling to write a simple code to sort an array of char in C and been failing miserably. This is what I have so far: int main() { char line[128]; char word[128]; int i=0; int j; int length; while(fgets(line,sizeof line,stdin) != NULL) { length=0; i=0; while (line[i]!='\0') i++; lengt...

replace characters in a string

i have a sting in which i want to replace all characters(except special characters) by X.. i mean if i have a string str= mac,iphone & ipad are products of apple theis should be converted to str= XXX,XXXXXX & XXXX XXX XXXXXXXX XX XXXXX i know this can be done by finding all special characters and note their position and then replace ...

Java int to String - Integer.toString(i) vs new Integer(i).toString()

Sometimes java puzzles me... I have a huge amount of "int" initializations to make. What's the "real" difference? Integer.toString(i) new Integer(i).toString() Thanks. ...

C strings concatenation - strange characters

Hi there. I'm writing a C program which takes n strings and concatenates them using strcat. First I alloc'd the target string at sizeof(char)* the strlen of every string + 1 (for the null character). Then with a for I use strncat to create the final string. At the and, I am appending the null character. Everything goes fine, but somet...

Convert base 16 string to base 256 string in C++, vice versa

Anyone knows how, or any libraries that can be used? Thanks in advance! char * base16Str="1234567F"; char * base256Str; ...

selecting an array key based on partial string

Hello there, I have an array and in that array I have an array key that looks like, show_me_160 this array key may change a little, so sometimes the page may load and the array key maybe show_me_120, I want to now is possible to just string match the array key up until the last _ so that I can check what the value is after the last und...

How to change the style of String in SWT?

I develop some features based on Eclispe GEF. I want to create a label with some string. for example: new Label("This is a good test stensece") Now, I want to get these effects "good" is in Bold font, and "test" is in italic. It looks like can use some HTML way to implement that So,is there any one knows that? Thank you very much...

Split textual script into substrings by pattern

Consider following script (it's total nonsense in pseudo-language): if (Request.hostMatch("asfasfasf.com") && someString.existsIn(new String[] {"brr", "hrr"})) { if (Requqest.clientIp("10.0.x.x")) { somevar = "1"; } somevar = "2"; } else { somevar = "first"; } string foo = "foo"; // etc. etc. How would you gr...

C String -- Using Equality Operator == for comparing two strings for equality

int main (int argc, **argv) { if (argv[1] == "-hello") printf("True\n"); else printf("False\n"); } # ./myProg -hello False Why? I realize strcmp(argv[1], "-hello") == 0 returns true... but why can't I use the equality operator to compare two C strings? ...

Determine if two strings are similar in Javascript?

Let's say I have two strings, is there any way to check if they are at least 90% similar? var string1 = "theBoardmeetstoday,tomorrow51"; var string2 = "Board meets today, tomorrow"; Thanks, Tegan ...

How could I encode a string of 1s and 0s for transport?

For a genetic algorithm application, I'm using a whole load of binary strings. Most of the time they literally take the form of 01001010110, so that they can be mated, mutated and "crossed-over". For transport and storage however, this seems wasteful. What's the simplest way to encode this as a shorter string? I'm guessing this is pret...

java String.replaceAll regex question

I have a string that contains the following text String my_string = "hello world. it's cold out brrrrrr! br br"; I'd like to replace each isolated br with <br /> The issue is that I'd like to avoid converting the string to "hello world. it's cold out <br />rrrrr! <br /> <br />"; What I'd like to do is convert the string (using ...

xcode std::wcout with wchar_t or std::wstring!

Hi, I am trying to print a wstring/wchar_t in xcode to the console but unfortunatelly it only works with basic chars (i think ascii) chars, everything else gets displayed in numbers, for instance the following: std::cout << "äöüu"<< std::endl; std::wcout << L"äöüu" << std::endl; while the cout version prints "äöüu" as expected I get t...