I have an app which lists many languages. In the app I compare language names.
When I compare language names with no accents it works and the compare is true.
When I compare languages with accents, it doesn't think they are equal.
In this case they are NOT equal (but should be).
Language = "Español";
MonoTouch.Foundation.NSString s =...
Hello
I am trying to decode data received over a tcp connection. The packets are small, no more than 100 bytes. However when there is a lot of them I receive some of the the packets joined together. Is there a way to prevent this. I am using python
I have tried to separate the packets, my source is below. The packets start with STX byt...
I have this code :
$count = 0;
preg_replace('/test/', 'test'. $count, $content,-1,$count);
For every replace, I obtain test0.
I would like to get test0, test1, test2 etc..
...
I have not worked with static libraries before, but now I need to.
Scenario:
I am writing a console app in Unix. I freely use std::string everywhere because it's easy to do so. However, I recently found out that I have to support it in Windows and a third party application would need API's to my code (I will not be sharing source, just...
I am somewhat new to unicode and unicode strings. I'm trying to determine the difference between "fullwidth" symbol and a normal one.
Take these two for example:
Normal: http://www.fileformat.info/info/unicode/char/20a9/index.htm
Fullwidth: http://www.fileformat.info/info/unicode/char/ffe6/index.htm
I notice that the fullwidth is def...
If I have:
const char *mystr = "cheesecakes";
FILE *myfile = fopen("path/to/file.exe","r");
I need to write a function to determine whether myfile contains any occurrences of mystr. Could anyone help me? Thanks!
UPDATE: So it turns out the platform I need to deploy to doesn't have memstr. Does anyone know of a free implementation I c...
hi, I am trying to get a normalized path on windows. The paths are stored in a list and i am looping over those as follows:
>>> lst = ['C:\\', 'C:\\Windows', 'C:\\Program Files']
>>> lst
['C:\\', 'C:\\Windows', 'C:\\Program Files']
>>> for pth in lst:
... print pth
...
C:\
C:\Windows
C:\Program Files
Notice that it has removed one ...
Hi, I am getting an error with this code. 'Incompatible types in assignment of char to char[13]' I can't figure out how to initialize these arrays and make this work. Basically, the program takes ISBN codes (4 groups of integers and makes one string with '-' in them between each group of numbers) and verifies that they are correct. The p...
Hey,
I'm trying to define a macro which is suppose to take 2 string values and return them concatenated with a one space between them.
It seems I can use any character I want besides space.
for example:
#define conc(str1,str2) #str1 ## #str2
#define space_conc(str1,str2) conc(str1,-) ## #str2
space_conc(idan,oop);
space_conc woul...
Do structures support inheritance? I think it's stupid question, but I have not much idea about it.
What is the meaning of writing code like this:
struct A {
void f() { cout << "Class A" << endl; }
};
struct B: A {
void f() { cout << "Class B" << endl; }
};
In structures also private section will come, don't they give encapsul...
How can I parse multiple values from a formatted string in C#?
The string is in this format:
"blah blah blah (foo:this, bar:that)"
I need to parse out the foo and the bar value. The parentheses are always at the end of the line.
Edit: Sorry... that wasn't very clear. What I meant was I need to know the "foo" value and the "bar" v...
Possible Duplicate:
Comparing StringBuffer content with equals
StringBuffer s1= new StringBuffer("Test");
StringBuffer s2 = new StringBuffer("Test");
if(s1.equals(s2)) {
System.out.println("True");
} else {
System.out.println("False");
}
Why does that code print "False"?
...
It might be a silly question but is there any difference between
std::string s1("foo");
and
std::string s2 = "foo";
?
...
I need to create a "obscuring" function which replaces clear-text password in line, before writing it to log.
It looks like this:
function pass_obscure {
my $logline = shift;
my $pass = "wer32pass$"; # this password is an example, the real one is received as parameter, or already stored as global value
$logline =~ ...
I have an XElement and I need to add more elements to it from a string. The string contains multiple xml elements in it that I need to parse. I have tried both XDocument.Load and XElement.Parse but get errors. The contents of the file are as follows:
<menu id="a">
<menuItem keyID="0">
<command>test</command>
</menuItem>
<menu...
I want to change the value of a particular string index, but unfortunately
string[4] = "a"
raises a TypeError, because strings are immutable ("item assignment is not supported").
So instead I use the rather clumsy
string = string[:4] + "a" + string[4:]
Is there a better way of doing this?
...
I'm writing a Python script that goes through a directory and gathers certain files, but there are a number of files I want excluded that all start the same.
Example code:
for name in files:
if name != "doc1.html" and name != "doc2.html" and name != "doc3.html":
print name
Let's say there are 100 hundred HTML files in the di...
Hi,
I'm trying to pass a string like this:
{"key":["value"],"key2":undefined,"key3":undefined,"key4":undefined,"key5":"value"}
to a javascript-function like this:
<a href="#" onClick="myFunction(myString);">
but can't get the escaping right. Is there a way to pass that object-string to a function or do I need to convert something?...
I'm writing a C Code in which my array of length 2 char contains String My But while printing it to the Screen using puts(). I'm getting this output
My £■ 0√"
What is the reason for such codes ???
And if my array length is 2 then How can i get output of length 2+ ???
...
I have a simple function that passes a variable "var" as a u_char array. I have no difficulty printing that array.
printf("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", var[0], var [1], var[2], var[3], var[4], var[5]);
Prints the mac address out just the way I like it.
I cannot for the life of me figure out the proper way to store this...