I want to copy a string into a char array, and not overrun the buffer.
So if I have a char array of size 5, then I want to copy a maximum of 5 bytes from a string into it.
what's the code to do that?
...
i want to check the combobox.selecteditem.tostring() on combobox select in a given xml with several nodes, where each one has an attribute called "name"
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
textBox1.AppendText(nameAttributeCheck(comboBox1.SelectedItem.ToString()));
}
cat...
I have the following string:
"h3. My Title Goes Here"
I basically want to remove the first 4 characters from the string so that I just get back:
"My Title Goes Here".
The thing is I am iterating over an array of strings and not all have the h3. part in front so I can't just ditch the first 4 characters blindly.
I have checke...
I'm looking for some best practice advice on enumerations and retrieving an associated string value. Given this:
public enum Fruits {
Apple,
Orange,
Grapefruit,
Melon
}
What is the best way to get a related string value of the name? Eg. "Grapefruit", given that the string value may not match the representation in the e...
Hi,
is it possible in wpf to access the header of a gridviewcolumn as gridviewcolumnheader?
I have an object:
GridViewColumn column;
But the "Header" property just returns a string (header text) not the "real" header object.
Can anyone help my?
...
I have an int that I want to first convert to a binary number. Then I want to store that binary number in a string. How can this be done?
...
I am using this code to get the windows version:
#define BUFSIZE 256
bool config::GetOS(LPTSTR OSv)
{
OSVERSIONINFOEX osve;
BOOL bOsVersionInfoEx;
ZeroMemory(&osve, sizeof(OSVERSIONINFOEX));
osve.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osve)) )
ret...
I'm trying to build a lexer to tokenize lone words and quoted strings. I got the following:
STRING: QUOTE (options {greedy=false;} : . )* QUOTE ;
WS : SPACE+ { $channel = HIDDEN; } ;
WORD : ~(QUOTE|SPACE)+ ;
For the corner cases, it needs to parse:
"string" word1" word2
As three tokens: "string" as STRING and word1" an...
My Friends,
I really want to extract a simple IP address from a string (actually an one-line html) using Python. But it turns out that 2 hours passed I still couldn't come up with a good solution.
>>> s = "<html><head><title>Current IP Check</title></head><body>Current IP Address: 165.91.15.131</body></html>"
-- '165.91.15.131' is w...
I've got some very basic code like
while (scan.hasNextLine())
{
String temp = scan.nextLine();
System.out.println(temp);
}
where scan is a Scanner over a file.
However, on one particular line, which is about 6k chars long, temp cuts out after something like 2470 characters. There's nothing special about when it cuts out; it's...
Having a string of whitespaces:
string *str = new string();
str->resize(width,' ');
I'd like to
fill length chars at a position.
In C it would look like
memset(&str[pos],'#', length );
How can i achieve this with c++ string, I tried
string& assign( const string& str, size_type index, size_type len );
but this seems to truncat...
heyy there
i want to parse a text,let's name it 'post', and 'urlize' some strings if they contain a particular character, in a particular position.
my 'pseudocode' trial would look like that:
def urlize(post)
for string in post
if string icontains ('#')
url=(r'^searchn/$',
searchn,
...
Problem : Take an integer as input and print out number equivalents of each number from input. I hacked my thoughts to work in this case but I know it is not an efficient solution.
For instance :
110
Should give the following o/p :
one
one
zero
Could someone throw light on effective usage of Arrays for this problem?
#import <F...
I'm trying to use an if statement to work out which of 2 strings comes first alphabetically. Like with numbers and greater and less than:
if (1 < 2) {
just with strings:
if(@"ahello" < @"bhello") {
Or would I have to have a string containing all the letters and then check the index of the first char in each string and see which ind...
Well I have been able to figure this out but what I want to do is make my string have a new line after 20 chars. I know how to find how many chars the string has but not how to insert environment.newline at 20 chars.
I am using this to find the string length
If string.Length > 20 then
'Need to be able to insert environment.newline at 2...
I'm trying to take 2 versions of text (10 pages long) and compare the 2 to produce the difference. I know Wikipedia has a similar feature to compare revisions. Does anyone know what they use? I'm hoping they're using a php-driven solution.
...
Shouldn't this work?
string s;
s = "some string";
...
I have a string called userEmail in my Flex 4 app that has a value of:
my%40email.com
I need to have an @ symbol instead of %40, so I run this line:
userEmail.replace("%40","@");
But the string has the same value after. What am I doing wrong?
Thanks for reading.
...
i have a username= LICTowner.
i need to get the prefix from the word LICTowner i.e LICT.
how to split the word and get the 4 letter prefix.
in asp.net using C#
...
I am creating an interpreter for my esolang, and I need the user to enter some text which then will be interpreted as an INTERCAL program. I want the user to enter text, which may contain any character including newlines, until the user presses ^X (Ctrl-X), like this:
Enter your code followed by ^X:
Bla
Blablabla
Bla^X
Thank you for ent...