string

Sequential Key Generation

Right now, I'm working on a project which requires sequential text key generation. I need to seed the key generator with an integer corresponding to a certain key, which the constructor converts to a key. My key generator overloads the increment operators so that the string is incremented directly, rather than what I had previously been...

How to create a String class replica?

I need to create a class with exactly the same methods as java.lang.String. What is the best way to do this in Java? I know that I can't extend String class as it is final. I am not looking at solutions where I need to copy the source code of java.lang.String. For example, assume that I need the functionality length() within my custom...

Why is String final in Java?

From when I learned that the class java.lang.String is declared as final in Java, I was wondering why is that? I didn't find any answer back then, but this post: How to create a replica of String class in Java? reminded me of my query. Sure, String provides all the functionality I ever needed, and never thought of any operation that wo...

Separate strings and include separating character in one of the returned components

Hi, Say I have the following string "Center-World" and I want to separate this string in two different strings but I want the dash to be part of "Center". With the code below I got a string with ["Center","World"] and I want something that returns ["Center-","World"]. Here is my code: NSCharacterSet *stringDelimiters = [NSCharacterSet ...

PHP Strip string of first url and report results

Russel Peter video: <a rel="nofollow" href="http://www.youtube.com/watch?v=2bP9tRhJRTw"&gt;www.youtube.com/watch?v=2bP9tRhJRTw&lt;/a&gt; russel peters video blah blah. Turtles: <a href="http://turtles.com"&gt;turtles.com&lt;/a&gt; I have a string that contains text and and tags with enclosed urls like the above example. I want to str...

Can C's fgets be coaxed to work with a string *not* from a file?

Specifically, the code sample here works great, but only when the string is stored in a file. Sometimes I need it to process a generated string (stored in a string variable), but I'm having trouble convincing fgets's third parameter to work with string variables because it's a pointer to a FILE structure. Or perhaps there's a functio...

How to change string resource xml values in Android programatically?

Hi All, Is there any possibility to Edit String.xml values in Android? Please suggest me the possible ways. I want to provide Enable/Disable option for my App. To accomplish this I can use SQLite database. But I doesn't like to Use DB for a single variable value. Thanks in Advance. With Regards, Raghavendra K. ...

Comparing a string with several different strings

I want to compare one string with many strings. How is that done in C#? ...

Find common prefix of strings

I am having 4 strings: "h:/a/b/c" "h:/a/b/d" "h:/a/b/e" "h:/a/c" I want to find the common prefix for those strings, i.e. "h:/a". How to find that? Usually I'd split the string with delimiter '/' and put it in another list, and so on. Is there any better way to do it? ...

How to calculate the length of a string in C efficiently?

How to calculate the length of a string in C efficiently (in time)? Right now I'm doing: int calculate_length(char *string) { int length = 0; while (string[length] != '\0') { length++; } return length; } But it's very slow compared to strlen() for example, is there any other way to do it? Thanks. EDIT: I'm w...

initializing multi-dim string arrays

Stuck here trying to initialize an array (c#) using a loop. The number of rows will change depending. I need to get back two values that I am calculating earlier in the program startweek, and endweek. Lots of examples on building int arrays using loops but nothing I can find re dynamic strings and multi dim arrays. Thanks how do I set ...

Escaping a Ruby String for TextMate's $DIALOG command

Calling regex gurus. I'm having some trouble right now with escaping a string in Ruby so that I can pass it into a command line utility using exec, %x{} or similar. The command line command is the TextMate dialog feature, which basically works like this (Run this as a shell script in TextMate.): $DIALOG -mp "items=('string1','string2', ...

How to parse complex string with C++ ?

I'm trying to figure out how could I parse this string using "sstream" and C++ The format of it is: "string,int,int". I need to be able to assign the first part of the string which contains an IP address to a std::string. Here is an example of this string: std::string("127.0.0.1,12,324"); I would then need to obtain string someSt...

Difference Between Single and Double Quoted Strings in ActionScript

Is there any difference between single and double quoted strings in ActionScript? ...

Display an html formatted string

I'd like to display a string that containts html code (mainly for formating purposes like italic, bold, indentation, colors etc.) from a C# console application. I don't think I'll need to go with a WebBrowser class for that, since there won't be any kind of navigation possible. 1) What would be the most straightforward way to do it? 2...

Extract string from between quotations

I want to extract information from user-inputted text. Imagine I input the following: SetVariables "a" "b" "c" How would I extract information between the first set of quotations? Then the second? Then the third? ...

Help in Regex - Match YouTube Url

I have the following string for example: abcba"c"bacba"fbaf"gdsfgafa"http://www.youtube.com/watch?v=0eLoApO7wrs"gsg How can I extract the youtube url from this string? ...

Best practice when converting DataColumn values to an array of strings?

Best practice when converting DataColumn values to an array of strings? [Edit] All values for certain DataColumn for all DataTable rows to be converted to an array of string? ...

List-Array Error?

I was working on a project which required pulling down and parsing a .html page from a server, then parsing it for content. I searched a string for two values as a unit test, then saved each of them to a List, then compared them to a manually created String[]. The code is below: SiteGrabber.java: //some imports import java.util.ArrayLi...

Shared memory and strings: managed?

I have a problem with boost::interprocess::string in shared memory. When I use a shared_memory_object I can manipulate a structure with different fields, BUT strings (I get a segmentation fault). On the other side, when I use managed_shared_memory everything is fine. Am I doing something wrong? Do you know if there is a performance...