string

JavaScript string and number conversion

How can I do the following in JavaScript? Step (1) Concatenate "1", "2", "3" into "123" Step (2) Convert "123" into 123 Step (3) Add 123 + 100 = 223 Step (4) Covert 223 into "223" ...

Truncate words function in javascript (studying dojo's code)

A 'truncate words' would take a string of words and return only the first, let's say, 10 words. In dojo (javascript library) they have such a function, whose code is this: truncatewords: function(value, arg){ // summary: Truncates a string after a certain number of words // arg: Integer // Number of words to tru...

Removing Junk Characters from Ruby String

I am trying to clean up a string that I get from a website using mechanize here is an except from the string with the junk characters "Mountain</b></a><br>ΓÇÄ1hr&nbsp;39minΓÇÄΓÇÄ - Rated&nbsp;PGΓÇÄΓÇÄ - Action/Adventure/Science&nbsp;fictionΓÇÄΓÇÄ - EnglishΓÇÄ - <a href=" Does any one know where they characters come from and how I can...

how to process string in java

I want to make strings like "a b c" to "prefix_a prefix_b prefix_c" how to do that in java? ...

How to make one variable = two others instead of just one

I posted this before and got a few answers that haven't worked for me so far. Therefore I'm going to post part of my code so you can see what I'm talking about. The highlighted part is what I pulled from another post and it's not working for me right now. I'm using visual studio 2008 and the program was written in Basic. I pulled mos...

convert nested lists to string

how can i convert the following list to a string? list1= [[1, '1', 1], [2,'2',2], [3,'3',3]] Result: '1 1 1' '2 2 2' '3 3 3' Thanks ...

SQL query--String Permutations

I am trying to create a query using a db on OpenOffice where a string is entered in the query, and all permutations of the string are searched in the database and the matches are displayed. My database has fields for a word and its definition, so if I am looking for GOOD I will get its definition as well as the definition for DOG. ...

How to assign form name to variable as string in jQuery?

if($(currentTab+' form.dataform').attr('name') !== undefined) var $selectedTab = $(currentTab+' form.dataform').attr('name'); else var selectedTab = '0'; alert($(selectedTab)); Gives me an object. I need string. How? ...

How do you extract a numerical value from a string in a MySQL query?

I have a table with two columns: price (int) and price_display (varchar). price is the actual numerical price, e.g. "9990" price_display is the visual representation, e.g. "$9.99" or "9.99Fr" I've been able to confirm the two columns match via regexp: price_display not regexp format(price/1000, 2) But in the case of a mismatch...

Concat string in C++(STL)

i have code like this string xml_path(conf("CONFIG")); xml_path+=FILE_NAME; Where, conf function returns char * and FILE name is const char * I want to combine it to one line like xml_path(conf("CONFIG")).append(FILE_NAME) how do i do it? any suggestions ?? ...

Read unicode text files with java

Real simple question really. I need to read a Unicode text file in a Java program. I am used to using plain ASCII text with a BufferedReader FileReader combo which is obviously not working :( I know that I can read a String in the 'traditional' way using a Buffered Reader and then convert it using something like: temp = new String(tem...

What does a hash/pound (#) represent in a format string?

I have some code to format a file size string: NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setPositiveFormat: @"#,##0.## bytes"]; Is the @"#,##0.## bytes" the same kind of format string as I'd use in stringWithFormat? What do the hash/pound symbols mean here? Thanks! ...

Static string variable in Objective C on iphone

Hi, How to create & access static string in iPhone (objective c)? I declare static NSString *str = @"OldValue" in class A. If i assign some value to this in class B as str = @"NewValue". This value persists for all methods in class B. But if I access it in class C (after assignment in B) I am getting it as OldValue. Am I missing somet...

What does Perl's substr do?

My variable $var has the form 'abc.de'. What does this substr exactly do in this statement: $convar = substr($var,0,index(".",$var)); ...

Clipboard viewer for programming purposes

I need a clipboard viewer in order to understand the type and contents of the data I'm receiving. Is there any such program available, (for Windows) that lets you explore any type of data currently in the clipboard? ClipSpy: Unfortunately the only workable multi-format viewer, ClipSpy, shows me the string data wrapped every 10 character...

splitting a full filename into parts

I am creating a function that will split a full unix filename(like /home/earlz/test.bin) into its individual parts. I have got a function, and it works for the first two parts perfect, but after that it produces erroneous output... strlcpy_char will copy a string using term as the terminator, as well as 0. If it is terminated with term...

C++ - How can I extract a valid string within a string?

The Problem: I am trying to extract a valid game mode for Defense of the Ancients (DotA) from a game name using C++. Details: Game names can be, at most, 31 characters long There are three game mode categories: primary, secondary, and miscellaneous There can only be 1 primary game mode selected Certain primary game modes are incompat...

Replicating String.split with StringTokenizer

Encouraged by this, and the fact I have billions of string to parse, I tried to modify my code to accept StringTokenizer instead of String[] The only thing left between me and getting that delicious x2 performance boost is the fact that when you're doing "dog,,cat".split(",") //output: ["dog","","cat"] StringTokenizer("dog,,cat") // ...

how to pass string array from C/C++ dll to vba (Excel)

how to pass string array from C/C++ dll to vba (Excel) dll in Visual Studio dll is not managed, ATL, etc. regards Andy ...

Javascript extracting number from string

Hi, I have a bunch of strings extracted from html using jQuery. They look like this: var productBeforePrice = "DKK 399,95"; var productCurrentPrice = "DKK 299,95"; I need to extract the number values in order to calculate the price difference. (So I wend up with ≈ var productPriceDiff = DKK 100"; or just: var productPriceDiff ...