string

PHP: Convert variable to array.

I'm trying to convert a variable to an array and split each character using PHP. So say I have a variable $name = 'John Smith'; How do I convert it to: array('J','o','h','n',' ','S','m','i','t','h'); Notice the space between John and Smith as well. Thank you. ...

Generate regular expression from diff

Hi, I am looking for a way to generate regex from based on the differences between 2 input strings. The regex can then be used to match the 3rd string that is also similar to the 2 input strings. For example, given 3 strings: f1, f2, and f3 f1: 111xxx222 f2: 111yyy222 f3: 111zzz222 I am wondering if there is a generic way to ...

Does xslt have split() function?

i want to split the string based on some separator. for e.g returns Topic1,Topic2,Tpoic3 as string. i want to split the string based on ",", the way we have in C#. Final output should be Topic1 Topic2 Topic3. Regards, Ketan ...

String Array problem in Scala

Hi, I just started playing in scala. I got a method that accepts string array as input def Lambdatest(args:Array[String]) = args.foreach(arg=>println(arg)) And i have create a string array like this var arr=new Array[String](3) arr(0)="ram" arr(1)="sam" arr(2)="kam" When i call Lambdatest(arr), it throws an error like the below ...

changing string to a function in javascript (not eval)

var foo = "function (){ alert('meee'); }"; foo(); I have tried the above but it does not work is there any other way to execute that function without using eval? thnx ...

How can I copy a part of a mutable array into a buffer, to send it via cfstreamwrite to a host

Hi friends, need some help: I have created a mutable array of ASCII- strings (21 per Key), which I like to transfer to a socket by using CFStream. Each string represents a key stroke (1 of 8). Here is the code, I'm using: // socket- initialising: for writestream, host, port, buf static CFWriteStreamRef writeStream = NULL; static C...

How to find similar results and sort by similarity?

How do I query for records ordered by similarity? Eg. searching for "Stock Overflow" would return Stack Overflow SharePoint Overflow Math Overflow Politic Overflow VFX Overflow Eg. searching for "LO" would return: pabLO picasso michelangeLO jackson polLOck What I need help with: Using a search engine to index & search a MySQ...

Get String Between 2 Strings

How can I get a string that is between two other declared strings, for example: String 1 = "[STRING1]" String 2 = "[STRING2]" Source: "832h0ufhu0sdf4[STRING1]I need this text here[STRING2]afyh0fhdfosdfndsf" How can I get the "I need this text here" using C++. ...

PHP: remove string character found in another string....

Hi guys. I am trying to compare two strings and remove any characters that appear in second string. For example: $stringA="abcdefg" ; $stringB="ayfcghifh" ; I want $stringB to be "yhih". Are there any ways to do it? Thanks for the help... ...

Extract a specific portion of connection string

Hello, Any way to extract what's after the @(if any) and before the next . (if any)? Examples: host host.domain.com user@host first.last@host [email protected] [email protected] I need to get host in a variable. Suggestions in Python? Any method is welcomed. Thanks, EDIT: I fixed my question. Need to match host and h...

VBScript to search two Strings in a TXT

Hello, i try to make a VBScript that read a txt and search for two strings and gives out only the last results. String 1: Hello123 String 2: Test123 The TXT looks like this: 27.07.2010 09:45 ... DumDumDum ... 27.07.2010 09:45 ... BlaBlaBla ... 27.07.2010 09:45 ... Hello123 ... 27.07.2010 09:45 ... BlaBlaBla ... 27.07.2010 09:45 ...

Sorting ArrayList of Objects by Object attribute

Hi, I am having an Arraylist of Objects. Those object have an attribute or datatype - 'String'. I need to sort the Arraylist by that string. How to achieve this? ...

std::stringstream bugs?

I've got my own DLL which is being injected into another process. From the other process, the DLL sends IPC messages via boost::message_queue to my application. I'm using std::stringstream to construct the messages, as following: class Client { ... private: template <class T> void AddMessageParameter(const T &m) ...

Huge Static Array of String

Hi, Is it a good idea to store words of a dictionary with 100.000 words in a static array of string. I'm working on spellchecker and I thought that way would be faster. ...

How to generate every possible combination of a string when given a list of values

Say I have a list of values, this list can be of any length: "100","200","300","400","500", ... And I have a template string that has a few tokens that need to be replaced: "@token1@-@token2@-@[email protected]@tokenN@" Using the list of values, how can I generate every possible combination of the values in the template? Values can be...

Wrap long lines in Python

How do I wrap long lines in Python without sacrificing on the indentation part? For example, consider this: >>> def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5) Suppose that this goes over the 79 character recommended limit. The way I read it, here is how to indent it: >>> def fun(): prin...

split string for firstname and lastname in vb.net

i have a string that comes in say "Joesph Van Andrews". I want to split it in such a way that firstname is "Joseph" and lastname is "Van Andrews" how can i do that in vb.net? ...

Python Base64 print problem

Hi all, I have a base64 encoded string When I decode the string this way: >>> import base64 >>> base64.b64decode("XH13fXM=") '\\}w}s' The output is fine. But when i use it like this: >>> d = base64.b64decode("XH13fXM=") >>> print d \}w}s some characters are missing Can anyone advise ? Thank you in advanced. ...

PHP: Problem with varible printing inside javascript

Hi, I have problem with varible printing inside javascript. varible htmlString printing not working: document.write(htmlString) <?php $htmlString= htmlspecialchars(file_get_contents('http://google.com'));?&gt; <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <bod...

C# - Multilingual string for "Cancel"

Hey I want to make multilingual buttons, like those of the messagebuttons. I have a form with a cancel-button, but I want to have a multilingual text. For example, in German it is named "Abbrechen, in French "Annuler" and in English "Cancel". Like for MessageBoxes, those buttons are also multilingual. Is it possible to find out the stri...