string

PHP: Showing Differences Between Two Strings

Is there a functional String Difference Highlighting class/function out there for PHP? This has been asked before http://stackoverflow.com/questions/321294/highlight-the-difference-between-two-strings-in-php but the answers given suggest PEAR's Text_Diff. I tried using Text_Diff and found it was giving me a bunch of STRICT NOTICES and...

BSTR and SysAllockStringByteLen() in C++

I'm new to C++, so this may be a noobish question; I have the following function: #define SAFECOPYLEN(dest, src, maxlen) \ { \ strncpy_s(dest, maxlen, src, _TRUNCATE); \ dest[maxlen-1] = '\0'; ...

Java: Parse a mathematical expression given as a string and return a number

Is there a way in Java to get the result from this mathematical expression: String code = "5+4*(7-15)"; Ie, what's the best way to parse an arithmetic expression? ...

C# String.Format args

I have an array like this: object[] args and need to insert those args in a string, for example: str = String.Format("Her name is {0} and she's {1} years old", args); instead of: str = String.Format("Her name is {0} and she's {1} years old", args[0], args[1]); NOTE: Actually the first line of code worked! But args[1] was missing...

Help adding string inside alert view

I have a sting that is equal to a text field that i want to insert inside of a UIAlertView. NSString *finalScore = [[NSString alloc] initWithFormat:[counter2 text]]; UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:finalScore message:@"You scored X points" ...

Use of hasNextLine in Java, won't read NextLine after NextInt

Hey guys and gals, I am trying to get this to work System.out.println("Please enter what SOCKET NUMBER you" + "wish to connect to"); int sockname = Integer.parseInt(inFromUser.nextLine()); System.out.println("Please enter what HOSTNAME you" + "wish to connect to"); String hostname = inFromUser.nextLine(); Th...

Convert hash to a hexadecimal character string

on this page: http://www.shutterfly.com/documentation/OflyCallSignature.sfly it says once you generate a hash you then: convert the hash to a hexadecimal character string is there code in csharp to do this? ...

How to properly trim whitespaces from a string in Java?

The JDK's String.trim() method is pretty naive, and only removes ascii control characters. Apache Commons' StringUtils.strip() is slightly better, but uses the JDK's Character.isWhitespace(), which doesn't recognize non-breaking space as whitespace. So what would be the most complete, Unicode-compatible, safe and proper way to trim a s...

obtaining objective c nsstring from c char[]

code below. i'm tryind to obtain string answers like "a1", "c4" this is what i'm having instead of "a1": "adresse finale: \340}00\214" with this prinf: printf("\nadresse finale: %s",[self convertCGPointToSquareAdress:self.frame.origin]); the method is: -(NSString *) convertCGPointToSquareAdress:(CGPoint ) point{ int x= point.x /...

Is it good to store long strings in a database?

I need to store long strings in a database. the string may be 5 or 6 sentences long. do you think this is a good design strategy. or should I store an id for that string and then create a relationship with another table that contains the location of the file storing the string. could you please give advantages and disadvantages of both. ...

Does WeakReference work with String?

In .NET 3.5, Does WeakReference work with String or shall I wrap it in a small "class" to make it work with it? ...

Rightmost occurrence string match in MySQL

I would like to extract the file extension from a field in MySQL that contains filenames. This means I need to find the final '.' character in the field and extract everything after that. The following code example partially works: SELECT LCASE(RIGHT(filename, LENGTH(filename) - LOCATE('.', filename))) FROM mytable; except that it f...

How do I get values by Perl string operations?

...

How can I shorten a string and later get back the original contents?

I have a really long string that I need to pass in a URL, say 10,000 characters. Anyone know a good way to shorten it to under 2,000 chars, and then on a server somehow get the original back? This is Objective-C talking to Ruby, but that shouldn't matter. ...

String Tiling Algorithm

I'm looking for an efficient algorithm to do string tiling. Basically, you are given a list of strings, say BCD, CDE, ABC, A, and the resulting tiled string should be ABCDE, because BCD aligns with CDE yielding BCDE, which is then aligned with ABC yielding the final ABCDE. Currently, I'm using a slightly naïve algorithm, that works as f...

javascript equivalent of join() and toString() in c#??

Hi, is there any method in c# thats equivalent to the javascript join().. var keyStr = keyList.join("_"); My requirement is to concatenate the array of strings into an single string with the given separator. And i wanted to convert my whole string array into an single string... in javascript we can do this by calling toString() ...

Convert an arbitrary string to xml in ruby

If I have a string which may contain any characters (including '/', '&',etc...) how do convert it safely into XML that can be stored like this: <myelement>mystring</myelement> Does it need to be CDATA, or can I easily convert it using a ruby function? ...

How can I extract substrings from a string in Perl?

Hi, Consider the following strings: 1) Scheme ID: abc-456-hu5t10 (High priority) * 2) Scheme ID: frt-78f-hj542w (Balanced) 3) Scheme ID: 23f-f974-nm54w (super formula run) * and so on in the above format - the parts in bold are changes across the strings. ==> Imagine I've many strings of format Shown above. I want to pick 3 su...

Dynamic SQL string wildcard % causes 'Invalid Column Name' in Visual Studio

Sproc in SQL Server 2005 parses, compiles and runs successfully via SQL Management Studio. I've recently imported the schema into Visual Studio Database Edition 2008 and attempting to 'build' the project. The collation on both the database I generated the script from , and the 'temporary' design time database are the same (SQL_Latin1...

How can I process a multi line string one line at a time in perl with use strict in place?

I'm trying to figure out the proper PBP approved way to process a multi line string one line at a time. Many Perl coders suggest treating the multi line string as a filehandle, which works fine unless you have "use strict" in your script. Then you get a warning from the compiler about not being able to use a string as a symbol while st...