string

How to Call my global value in app.config file

Hai, am using c# and wpf am having my value as a string, i need to call the string value in my app.config file for example in app.config file am having my connection string. the username may vary diff time. am having the user name as a globasl string. i need to call that string in my app.config connection string when application startu...

how to change '(1,2,3,4)' to '1,2,3,4'

this is my code: var a='(1,2,3,4)' a=a.slice(-1,1) alert(a) and i print nothing. thanks ...

Strange Ruby String Selection

The string in question (read from a file): if (true) then { _this = createVehicle ["Land_hut10", [6226.8901, 986.091, 4.5776367e-005], [], 0, "CAN_COLLIDE"]; _vehicle_10 = _this; _this setDir -2.109278; }; Retrieved from a large list of similar (all same file) strings via the following: get_stringR(string,"if","};") And the fun...

[C++] Index strings by other strings

Hello, I need to index specific strings with other strings and I can't really find a good way to do so. I tried to use tr1::unordered_map, but I'm having some difficulties using it. If someone could tell me what is the best way to do that I'd be really grateful :) I also need to index objects by a number (numbers are not in order so I ca...

how to retrieve part of a string in java?

Hello everyone, I am designing a chat applet. In this, a user will append his name to the beginning of the message that he sends to the other user. In the window of other user, I want to retrieve the appended user name from that string. How do I do that? The message sent by the user is as follows : final_msg = user_name + ": " + user_m...

C# string.Split() Matching Both Slashes?

I've got a .NET 3.5 web application written in C# doing some URL rewriting that includes a file path, and I'm running into a problem. When I call string.Split('/') it matches both '/' and '\' characters. Is that... supposed to happen? I assumed that it would notice that the ASCII values were different and skip it, but it appears that I'm...

Java: the method to strip a string to an array at space?

Just a blackout, I want the String "hello hallo tjena hej tere" to an array broken at space. ...

C# Regex: Capture everything up to...

I want to capture everything up to (not including) a # sign in a string. The # character may or may not be present (if it's not present, the whole string should be captured). What would the RegEx and C# code for this by? I've tried: ([^#]+)(?:#) but it doesn't seem to work. ...

Delphi: Any StringReplaceW or WideStringReplace functions out there?

Are there any wide-string manipulation implementations out there? function WideUpperCase(const S: WideString): WideString; function WidePos(Substr: WideString; S: WideString): Integer; function StringReplaceW(const S, OldPattern, NewPattern: WideString; Flags: TReplaceFlags): WideString; etc ...

Help with \0 terminated strings in C#

I'm using a low level native API where I send an unsafe byte buffer pointer to get a c-string value. So it gives me // using byte[255] c_str string s = new string(Encoding.ASCII.GetChars(c_str)); // now s == "heresastring\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0(etc)"; So obviously I'm not doing it right, how I get rid of the excess? ...

If statement not effective

void spriteput(int x,int y, int stype) { char sprite1[5]="OOOO"; char sprite2[5]="OOOO"; char sprite3[5]="OOOO"; char sprite4[5]="OOOO"; if (stype == 1) { char sprite1[5] = " OO "; char sprite2[5] = "OOOO"; char sprite3[5] = "OOOO"; char sprite4[5] = " OO "; mvprintw(2,y,"%s...

Making your own "int" or "string" class

I disassembled the .NET 'System' DLL and looked at the source code for the variable classes (string, int, byte, etc.) to see if I could figure out how to make a class that could take on a value. I noticed that the "Int32" class inherits the following: IComparable, IFormattable, IConvertible, IComparable, IEquatable. The String and Int32...

Why the output is not same ??

The output of the fist System.out.println() is not same as the second System.out.println() What may be the reason? public class swapex{ public static int var1, var2; public void badSwap(int var1, int var2){ int temp = var1; this.var1 = var2; this.var2 = temp; System.out.println("var1 " + var1 + "...

Why is this statement treated as a string instead of its result?

I am trying to perform some composition-based filtering on a large collection of strings (protein sequences). I wrote a group of three subroutines in order to take care of it, but I'm running into trouble in two ways - one minor, one major. The minor trouble is that when I use List::MoreUtils 'pairwise' I get warnings about using $a and...

How to search for multiple strings in a file

I want to search for the occurrence of string1 OR string2 OR string3, etc. in a file, and print only those lines (to stdout or a file, either one). How can I easily do this in bash? ...

How to Load type from string directly into linq expression in C# ?

This is the definition: public static IEnumerable<TResult> OfType<TResult>(this IEnumerable source); How to replace TResult with something like: Type.GetType("MyClass from assembly"); ...

Is there a circular hash function?

Thinking about this question on testing string rotation, I wondered: Is there was such thing as a circular/cyclic hash function? E.g. h(abcdef) = h(bcdefa) = h(cdefab) etc Uses for this include scalable algorithms which can check n strings against each other to see where some are rotations of others. I suppose the essence of the hash...

How to filter a string using c# using the logic of LIKE in SQL?

I have a string variable in C# aka product_name, I want to filter like this and have it return true or false: product_name LIKE '%BONUS NAME%' How can I do that please? regards bk PS: I have to do it on C# not SQL ...

validating a string in php if only substring is true

How to validate a substring is true in PHP for example if user1 is in the string it should be true? textfile: user1 : pass1 user2 : pass2 user3 : pass3 if(in_array($_SERVER['user1'] . "\r\n", $textfile)){ //not the way want this to be true printf("Ok user1 is in this row somewhere"); } ...

return new string vs .ToString()

Take the following code: public static string ReverseIt(string myString) { char[] foo = myString.ToCharArray(); Array.Reverse(foo); return new string(foo); } I understand that strings are immutable, but what I dont understand is why a new string needs to be called return new string(foo); instead ...