string

convert javascript comma separated string into an array

I have a comma separated string that I want to convert into an array so I can loop through it. Is there anything built-in to do this? ...

Python: converting string to flags

If I have a string that is the output of matching the regexp [MSP]*, what's the cleanest way to convert it to a dict containing keys M, S, and P where the value of each key is true if the key appears in the string? e.g. 'MSP' => {'M': True, 'S': True, 'P': True} 'PMMM' => {'M': True, 'S': False, 'P': True} '' => {'M': False, 'S...

How to turn string into readable by php server way? (ActionScript)

So I know that my server on real form submit turns %CE%EB%E5%E3+%DF%EA%F3%F8%EA%E8%ED into Олег Якушкин . How to peform string transfer from Олег Якушкин into %CE%EB%E5%E3+%DF%EA%F3%F8%EA%E8%ED using ActionScript? (Its ok if a space character as %20, not + , PHP should handle that fine.) ...

Path String Concatenation Question.

Hi. Please see my code below. ifstream myLibFile ("libs//%s" , line); // Compile failed here ??? I want to combine the path string and open the related file again. #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; ifstream myfile ("libs//Config.txt"); // There are severa...

Blackberry - How to print HTML String in a field

Hi Everyone, I have an HTML String like <p>something</p> etc... some other html string etc... <p>something</p> I would like to print in a field this string formatted. in android I use a webview... in iphone a UIWebView... but in BlackBerry? Thanks ;) Sergio ...

How to generate a random String in Java

Hi everyone, I have an object called Student, and it has studentName, studentId, studentAddress, etc. For the studentId, i have to generate random string consist of seven numeric charaters, eg. studentId = getRandomId(); studentId = "1234567" <-- from the random generator. and i have to make sure that there is no duplicate id. than...

drupal: standard way for creating a slug from a string

Hi there, A slug on this context is a string that its safe to use as an identifier, on urls or css. For example, if you have this string: I'd like to eat at McRunchies! Its slug would be: i-d-like-to-eat-at-mcrunchies I want to know whether there's a standard way of building such strings on Drupal (or php functions available from ...

C#: access a class property when the property identifier is known as a string

Hi, I'm using LINQ to Entities on a database which structure is not known in advance. I use reflection to retrieve the information, and now have a list of strings with all the table names. Because I use LINQ, I also have the datasource encapsulated in a C# class (linqContext), with each table being a property of that class. What I want...

How do I convert a string the looks like a hex number to an actual hex number in php?

Hey everyone, I have a string that looks like this "7a" and I want to convert it to the hex number 7A. I have tried using pack and unpack but that is giving me the hex representation for each individual character. I'm out of ideas and don't know where to go from here. Thanks for the help! ...

How to use setted variables in Config.Groovy and concatenate it

I want to reuse vars setted once again later in Config.groovy Example: static.serverURL = "http://static.foo.com" static.path = "" bar.default.picUrl=static.serverURL+static.path+"/images/bar.png" but that gives me a groovy.util.ConfigObject.plus() is applicable for argument types: (java.lang.String) changing it to bar.default.p...

whats wrong with strcpy()

What is wrong with strcpy() in this code? void process_filedata(char *filename) { void* content; const char * buffer; char * temp; char * row; char * col; int lsize,buflen,tmp,num_scan; //num_scan - number of characters scanned int m=0,p=0,d=0,j=0; //m - machine, p - phase, d- delimiter, j - job FILE *file_pointer = fop...

bash string replacing a some char with another

folks, i have a string like AxxBCyyyDEFzzLMN I want to replace all x and y and z with _ so that the output is A_BC_DEF_LMN How to do that? I know a series of echo "$string" | tr 'x' '_' | tr 'y' '_' will work, but I want to do taht in one go, without using pipes EDIT: The following worked echo "$string" | tr '[xyz]' '_' ...

Linq-To-Sql equivalent for this sql query...

I thus far used concatenated Id string like 1,2,3 and updated in my table using this query... if exists( select ClientId from Clients where ClientId IN (SELECT i.items FROM dbo.Splitfn(@Id,',') AS i)) begin update Clients set IsDeleted=1 where ClientId IN (SELECT i.items FROM dbo.Splitfn(@Id,',') AS i) select 'delete...

Help with manipulating some strings.

My strings are of this kind: City (PR) from a Database, where PR stands for Province. At the end I want two separate variables. City and PR. I have to do this with C#. Any idea? Thanks. ...

C# decimal places with integer operators

So I have this code: p.Value = 1; decimal avg = p.Value * 100 / 10000; string prntout = p.Key + " : " + avg.ToString(); Console.WriteLine(prntout); But the program prints out 0, instead of 0.01. p.Value is an int. How do I fix that? ...

Problem comparing French character Î

When comparing "Île" and "Ile", C# does not consider these to be to be the same. string.Equals("Île", "Ile", StringComparison.InvariantCultureIgnoreCase) For all other accented characters I have come across the comparison works fine. Is there another comparison function I should use? ...

What's the most efficient way to format the following string?

I have a very simple question, and I shouldn't be hung up on this, but I am. Haha! I have a string that I receive in the following format(s): 123 123456-D53 123455-4D 234234-4 123415 The desired output, post formatting, is: 123-455-444 123-455-55 123-455-5 or 123-455 The format is ultimately dependent upon the total number o...

Edit strings vars in compiled exe? C++ win32

I want to have a few strings in my c++ app and I want to be able to edit them later in the deployed applications (the compiled exe), Is there a way to make the exe edit itself or it resources so I can update the strings value? The app checks for updates on start, so I'm thinking about using that to algo send the command when I need to ...

Why is there garbage in my TCHAR, even after ZeroMemory()?

I have inherited the following line of code: TCHAR temp[300]; GetModuleFileName(NULL, temp, 300); However, this fails as the first 3 bytes are filled with garbage values (always the same ones though, -128, -13, 23, in that order). I said, well fine and changed it to: TCHAR temp[300]; ZeroMemory(temp, 300); GetModuleFileName(NULL, tem...

Does string concatenation use StringBuilder internally?

Three of my coworkers just told me that there's no reason to use a StringBuilder in place of concatenation using the + operator. In other words, this is fine to do with a bunch of strings: myString1 + myString2 + myString3 + myString4 + mySt... The rationale that they used was that since .NET 2, the C# compiler will build the same IL if...