string

How to convert a fomula to a valid identity name in C#?

In an application, I have to use a valid identity string as a value of a property. I mean the string should be a valid identity name in C#. For I want to use the string as a formula without change the source code of the component, I have to convert ANY formula, a string, to a valid identity string and convert it back when needed.Of cour...

How to handle carriage return with windows batch script?

Hi, I want to use bat to automate some of my work. It should first look up the value of a certain registry key, and then copy some files to the directory that included in the registry key value. I used reg query command to look up registry, such as: REG QUERY "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PROCE...

dlmwrite function - strings in matrixes

Am trying to write a *.txt file with 3 different matrixes (same number of rows). I am using the dlmwrite function but it doesn’t work with one of the matrixes, which is composed by strings (names of input files). I am getting an output where the strings are split into characters. Why is this happening? How can I solve this problem? dlm...

Difference between Convert.ToString Method and Object.ToString() with regard to Globalization

Is there any difference between Convert.ToString Method and Object.ToString() in C#.net other than how these handle null value. There could be some difference between the two in Globalization Perspective. ...

What's wrong with this line?

I am trying to remove all the " from a string called s1, I have this line s1=replace (s1, """, "") But I get a compile error saying it is expecting a list separator or ) How can I fix it? Thanks in advance. ...

How to regex match a string of alnums and hyphens, but which doesn't begin or end with a hyphen?

I have some code validating a string of 1 to 32 characters, which may contain only alpha-numerics and hyphens ('-') but may not begin or end with a hyphen. I'm using PCRE regular expressions & PHP (albeit the PHP part is not really important in this case). Right now the pseudo-code looks like this: if (match("/^[\p{L}0-9][\p{L}0-9-]{...

Characters in string changed after downloading HTML from the internet.

Using the following code, I can download the HTML of a file from the internet: WebClient wc = new WebClient(); // .... string downloadedFile = wc.DownloadString("http://www.myurl.com/"); However, sometimes the file contains "interesting" characters like é to é, ← to ↠and フシギダネ to フシギダãƒ. I think it may be something to do...

How to map this to something readble in Java ?

How do I map : "10%3A23%3A54+Apr+23%2C+2010+PDT" to something readable in Java ? Frank ...

How can I parse_url in PHP when there is a URL in a string variable?

I am admittedly a PHP newbie, so I need some help. I am creating a self-designed affiliate program for my site and have the option for an affiliate to add a SubID to their link for tracking. Without having control over what is entered, I have been testing different scenarios and found a bug when a full URL is entered (i.e. "http://examp...

Simple, Custom Parsing with c++

Hi! I have been reading SO for some time now, but I truly cannot find any help for my problem. I have a c++ assignment to create an IAS Simulator. Here is some sample code... 0 1 a 1 2 b 2 c 3 1 10 begin 11 . load a, subtract b and offset by -1 for jump+ 11 load M(0) 12 sub M(1) 13 sub M(3) 14 halt Using c++, I ne...

String Formatting Tricks/Docs

Was reading the response by Shaggy Frog to this post and was intrigued by the following line of code: NSLog(@"%@", [NSString stringWithFormat:@"%@:%*s%5.2f", key, padding, " ", [object floatValue]]); I know string formatting is an age old art but I'm kinda doing the end around into Cocoa/Obj-C programming and skipped a few grades alo...

Quick strlen question

Hi again. I've come to bother you all with another probably really simple C question. Using the following code: int get_len(char *string){ printf("len: %lu\n", strlen(string)); return 0; } int main(){ char *x = "test"; char y[4] = {'t','e','s','t'}; get_len(x); // len: 4 get_len(y); // len: 6 return 0;...

Why is '\x' invalid in Python?

I was experimenting with '\' characters, using '\a\b\c...' just to enumerate for myself which characters Python interprets as control characters, and to what. Here's what I found: \a - BELL \b - BACKSPACE \f - FORMFEED \n - LINEFEED \r - RETURN \t - TAB \v - VERTICAL TAB Most of the other characters I tried, '\g', '\s', etc. just eva...

Strings don't seem to be equal in Java on Android, even though they print the same

I've got a problem that I'm rather confused about. I have the following lines of code in my android application: System.out.println(CurrentNode.getNodeName().toString()); if (CurrentNode.getNodeName().toString() == "start") { System.out.println("Yes it does!"); } else { System.out.println("No it doesnt"); } When I look at the ...

Passing a string from C# to cpp with COM

I have a C# COM server which is consumed by a cpp client. One of the C# methods returns a string. In cpp the returned string is represented in Unicode (UTF-16), at least according to the memory view. Is this always the case with COM strings? Is there a way to use UTF-8 instead? I saw some code where strings were passed between cpp an...

Java Anagram Solver

I can work out how to create anagrams of a string but I don't know how I can compare them to a dictionary of real words to check if the anagram is a real word. Is there a class in the Java API that contains the entire English dictionary? ...

ruby c extensions: character values over 127

I am trying to make a C extension for Ruby that includes a method returning a string, which will sometimes have character values that need to be in an unsigned char. In http://github.com/shyouhei/ruby/blob/trunk/README.EXT, all of the functions listed for turning C strings into Ruby strings take signed chars. So I couldn't do this: unsi...

regular expression of 0's and 1's

Hello all I got this question which asks me to figure out why is it foolish to write a regular expression for the language that consists of strings of 0's and 1's that are palindromes( they read the same backwards and forwards). part 2 of the question says using any formal mechanism of your choice, show how it is possible to express t...

Why is my PHP string being converted to 1?

Ok, so here's the quick rundown. I have a function to generate the page numbers. This: <?php die($ani->e->tmpl->pages("/archive", 1, 15, 1, true)); ?> will output Single Page like expected. But this: <?php $page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true); ?> <?= $page_numbers ?> will output a simple 1 to the page....

How to get a char* pointer to a C++ string?

I have a C++ string. I need to pass this string to a function accepting char* parameter, for example - strchr(). a) How do I get that pointer? b) Is there some funtion equivalent to strschr() that works for C++ strings? ...