Hi,
I had just written a programme which reverses a sentence whatever the user gives.
for eg:If the user gives the sentence as "How are you",my programm generates "uoy era woH".
The programme which i had written is shown below.I just have a wild intution that there can be a smarter programe than the one which i had written.So valuab...
I have a program that allows the user to enter a level number, and then it plays that level:
char lvlinput[4];
std::cin.getline(lvlinput, 4)
char param_str[20] = "levelplayer.exe "
strcat_s(param_str, 20, lvlinput);
system(param_str);
And the level data is stored in folders \001, \002, \003, etc., etc. However, I have no way of tellin...
Hey,
Is there a platform-independent way of writing the EOF symbol to a string in Ruby. In *nix I believe the symbol is ^D, but in Windows is ^Z, that's why I ask.
Cheers
Pete
...
Hello. This is an ANSI C question. I have the following code.
#include <stdio.h>
#include <locale.h>
#include <wchar.h>
int main()
{
if (!setlocale(LC_CTYPE, "")) {
printf( "Can't set the specified locale! "
"Check LANG, LC_CTYPE, LC_ALL.\n");
return -1;
}
wint_t c;
while((c=getwc(stdin))!=...
From a brief look using Reflector, it looks like String.Substring() allocates memory for each substring. Am I correct that this is the case? I thought that wouldn't be necessary since strings are immutable.
My underlying goal was to create a IEnumerable<string> Split(this String, Char) extension method that allocates no additional me...
I'm attempting to convert a string to a TStream. My code below gives me an "Abstract Error" message on the CopyFrom line. I'm against a brick wall here, any ideas on how to solve this?
procedure StringToStream(const AString: string; out AStream: TStream);
var
SS: TStringStream;
begin
SS := TStringStream.Create(AString);
try
...
I was thinking to a solution to calculate length of string in c# without using Length property.
I thing which I can think of is getting this done is
Program is in C#
public static int strlen (string s)
{
string temp = s + '/0';
char [] c = temp.ToCharArray();
int length = 0;
while (c[length]!='/0'...
I am trying to save data into my database using a vb form. I am using a datetimepicker to insert the date into my database. Here's an example
saveCommand.Parameters.AddWithValue("A_BOOKDATE", abookdatePicker1.Text).DbType = DbType.DateTime
In my database i set its attribute to time ,now the thing is i used the same line of code on anot...
I'm writing a Bison/Flex program to convert LaTeX into MathML. At the moment, dealing with functions (i.e. \sqrt, \frac, etc) works like this, with a token for every function
\\frac {return FUNC_FRAC;}
and passes the token FUNC_FRAC back to bison, which plays its part in the description of this subtree:
function: FUNC_FRAC L...
Hi,
Is there a standard C function similar to strtol which will take a char* and a length for a non-null-terminated string?
I know that I could copy out the string into a null-terminated region, but for efficiency reasons that is undesirable.
Thanks.
...
Hi.
Is there any performance differences between string.Format and String.Format ?
As far as i understand string is a shortcut for System.String and there's no difference between them. Am i right?
Thanks!
...
I have a string as
string = "firstName:name1, lastName:last1";
now I need one object obj such that
obj = {firstName:name1, lastName:last1}
How can I do this in JS?
...
Hi,
I'm sure this is an easy one for you geeks:
Say I have a String "ThisIsMyString" and I want to format it like "this_is_my_string" using Ruby.
How do I do that?
Matt
...
I am trying to create an array of strings in C. If I use this code:
char (*a[2])[14];
a[0]="blah";
a[1]="hmm";
gcc gives me "warning: assignment from incompatible pointer type". What is the correct way to do this?
edit: I am curious why this should give a compiler warning since if I do printf(a[1]);, it correctly prints "hmm".
...
Ok, I know this is a very basic question, but my head is swimming in NSString vs C string
nonsense.
Basically I have a NSString the just contain 1 character for example the letter D
How do I take that 1 character NSString and assign it to a variable of char
So I have...
char mychar;
NSString *myMode = [[NSString alloc] initWithFo...
Which is the better API? I think the latter approach is better because strings are interned. But I'm pining for succintness. Which do you think is better?
[Task("Assortment", Author = "好先生", MenuTree = "The>Quick>Brown>Megan")]
public partial class Form1 : MycForm, ITaskPlugin
{
}
or this(strings can be interned):
[Task("As...
The Javadoc about String.intern() doesn't give much detail. (In a nutshell: It returns a canonical representation of the string, allowing interned strings to be compared using ==)
When would I use this function in favor to String.equals()?
Are there side effects not mentioned in the Javadoc, i.e. more or less optimization by the JIT co...
Hi,
I've done some simple string -> DateTime conversions before using DateTime.ParseExact(), but I have a string that I can't seem to get parsed properly. I'm probably doing something very obvious wrong but I just can't see what it is.
The code is as follows:
string date = "Tue Jun 23, 2009 2:23 pm";
DateTime lastupdate = DateTime.Par...
Well, I am abit confuse using these \r,\n,\t etc things. Because I read online (php.net), it seems like works, but i try it, here is my simple code:
<?php
$str = "My name is jingle \n\r";
$str2 = "I am a boy";
echo $str . $str2;
?>
But the outcome is "My name is jingle I am a boy"
Either I put the \r\n in the var or i...
Is there a nicer way to write in jUnit
String x = "foo bar";
Assert.assertTrue(x.contains("foo"));
...