string

why concat() is not working here? , java

Consider the code below, String s = "TEST"; String s2 = s.trim(); s.concat("ING"); System.out.println("S = "+s); System.out.println("S2 = "+s2); Output obtained : S = TEST S2 = TEST BUILD SUCCESSFUL (total time: 0 seconds) Why "ING" is not concatenated? ...

jQuery: Quick question. How to select string variable?

Hello world, EDIT: I would like to avoid doing something like this: var str = 'Hello'; if ( str == 'Hello') { alert(str); } I would rather do: var str = 'Hello'; $(str).filter(':contains("Hello")').each(function(){ alert(this) }); I've tried a lot of things: $(str).text().method1().method2().method3(); $(str).val(...

Assembly GDB Print String

So in assembly I declare the following String: Sample db "This is a sample string",0 In GDB I type "p Sample" (without quotes) and it spits out 0x73696854. I want the actual String to print out. So I tried "printf "%s", Sample" (again, without quotes) and it spits out "Cannot access memory at address 0x73696854." Short version: How d...

C# - Reading in text file; parsing for specific text

I have a text data file which contains text like this: "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" "[category.type.group.subgroup]" - "2934:10,4388:20,3949:30" 34i23042034002340 ----- "[category.ty...

Making a string out of a string and an integer in Python

I get this error when trying to take an integer and prepend "b" to it, converting it into a string: File "program.py", line 19, in getname name = "b" + num TypeError: Can't convert 'int' object to str implicitly That's related to this function: num = random.randint(1,25) name = "b" + num ...

Working with strings in C++

Hi. I'm working with strings in C++. I recently came across a problem when entering strings. I'm using cin >> string; to get my string as user input. When the user enters a space into the string, the next input is automatically filled out with the remaining letters, or sometimes left blank. As the next input string is often an integer, t...

Regular expression in C#

i have text something like this. @@MMIVLoader@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@ @@MMIVLib@[email protected]@BCM_7400S_LE@Product@Aug 21 2009@ @@HuaweFGDLDrv@[email protected]@7324@PRODUCT@Aug 20 2009@ @@ProtectVer@[email protected] @BCM_SDE5.03@PRODUCT@Aug 4 2009 06:56:19@ @@KernelSw@[email protected]@BCM-7454@...

Using an int as the numerical representation of a string in C#

I'm trying to use an integer as the numerical representation of a string, for example, storing "ABCD" as 0x41424344. However, when it comes to output, I've got to convert the integer back into 4 ASCII characters. Right now, I'm using bit shifts and masking, as follows: int value = 0x41424344; string s = new string ( new ...

Spotting similarities and patterns within a string - Python

Hi folks, this is the use case I'm trying to figure this out for. I have a list of spam subscriptions to a service and they are killing conversion rate and other usability studies. The emails inserted look like the following: [email protected] [email protected] [email protected] ro...

IsDouble check for string in Vb.net?

I will get data in DataTable. I am going to iterate data in foreach. I will have all types of data in Datatable. Now I need to find Double for each item (string) in DataTable. How to find IsDouble for string? Ex: I have "21342.2121" string. I need to covert this to Double. But sometimes the data will be "TextString". So I can't use Do...

Question about the String.replaceAll() and String.replaceFirst() method.

I need to do a simple string replace operation on a segment of string. I ran into the following issue and hope to get some advice. In the original string I got, I can replace the string such as <div class="more"> to something else. BUT, in the same original string, if I want to replace a much long string such as the following, it won’t...

Help with regex in javascript.

Whatever string is given I have to see if there is exactly one space after and before =, If it is more than one space in either side I have to reduce that to one and if there is none, I have to insert one. How should I do that ? String can contain anything. Thanks ...

String regex matching in Erlang

How would I do regex matching in Erlang? All I know is this: f("AAPL" ++ Inputstring) -> true. The lines that I need to match "AAPL,07-May-2010 15:58,21.34,21.36,21.34,21.35,525064\n" In Perl regex: ^AAPL,* (or something similar) In Erlang? ...

Why does this program segfault

Upon compiling and running this small program to reverse a string, I get a Segmentation Fault before any output occurs. Forgive me if this is an obvious question, I'm still very new to C. #include <stdio.h> int reverse(char string[], int length); int main() { char string[] = "reversed"; printf("String at start of main = %s", stri...

How can I create a Base64-Encoded string from a GDI+ Image in C++?

I asked a question recently, How can I create an Image in GDI+ from a Base64-Encoded string in C++?, which got a response that led me to the answer. Now I need to do the opposite - I have an Image in GDI+ whose image data I need to turn into a Base64-Encoded string. Due to its nature, it's not straightforward. The crux of the issue is ...

How to remove BBCode from a string in .Net

I'm trying to remove all BBCode Tags from a string. [url]www.google.com[/url] becomes www.google.com I have a regex that works in php to find them all, just dont know how to remove them in .net RegEx to Find BBCode |[[\/\!]*?[^\[\]]*?]|si ...

Number of simple mutations to change one string to another?

Hi; I'm sure you've all heard of the "Word game", where you try to change one word to another by changing one letter at a time, and only going through valid English words. I'm trying to implement an A* Algorithm to solve it (just to flesh out my understanding of A*) and one of the things that is needed is a minimum-distance heuristic. ...

collection/string .Contains vs collection/string.IndexOf

Is there a reason to use .Contains on a string/list instead of .IndexOf? Most code that I would write using .Contains would shortly after need the index of the item and therefore would have to do both statements. But why not both in one? if ((index = blah.IndexOf(something) >= 0) // i know that Contains is true and i also have the ...

Parcing formula to put in to excel cell using C# and SpreadSheetGear?

Hey can any body suggest that how to store excel formula as string, and parse this formula in c# to put it in to dynamically created excel sheet. ...

Calculating probability that a string has been randomized? - Python

Hi folks, this is correlated to a question I asked earlier (question) I have a list of manually created strings such as: lucy87 gordan_king fancy_unicorn77 joplucky_kanga90 base_belong_to_narwhals and a list of randomized strings: johnkdf pancake90kgjd fancy_jagookfk manhattanljg What gi...