hello all,
i keep getting an "Index is out of bounds of array" error on line # 574 which is:
label.Font = new Font(fontNameFields[0], Single.Parse(fontNameFields[1]));
... The following text file i am parsing contains this exact information:
Label
"hi tyler"
23, 76
Arial,12.5
...I can successfully parse all the other info (just not...
How should this function be changed to return "123456"?
def f():
s = """123
456"""
return s
UPDATE: Everyone, the question is about understanding how to not have \t or whatever when having a multiline comment, not how to use the re module.
...
Hello,
I am quite new to the C++ 'area' so I hope this will not be just another silly 'C++ strings' question.
Here is my problem. I want to integrate TagLib (1.5, 1.6 as soon as I manage to build it for Windows) into an existing Windows MFC VS2005 project. I need it to read audio files metadata (not write).
The problem is that the pr...
What are the string limits for the Standard Template Library in C++?
...
I am marshalling data between a C# and C++ application. In the C# application, I force the size of a string to be some size (say, 256 bytes). I would like to read in that exact same amount in C++ (I will be recreating the structs with reinterpret_cast) so that the data will remain formatted as it was in the C# application. Unfortunate...
I've been having a hard time trying to get the right answers for my problem. And have spent numerous days searching online and in documentation and have found nothing.
I have a Text File that contains a bunch of text. And on one of those lines inside the file will contain some Font info like this:
Tahoma,12.5,Regular
Note that the fon...
I have a class with a private char str[256];
and for it i have an explicit constructor,
explicit myClass(const char *func)
{
strcpy(str,func);
}
i call it as,
myClass obj("example");
when i compile this i get the following warning:
deprecated conversion from string constant to 'char*'
can anyone please provide a pointer to this...
I am using java to draw some text, but it is hard for me to calculate the string's width.
for example:
zheng中国...
How long will this string occupy?
...
So I know about String#codePointAt(int), but it's indexed by the char offset, not by the codepoint offset.
I'm thinking about trying something like:
using String#charAt(int) to get the char at an index
testing whether the char is in the high-surrogates range
if so, use String#codePointAt(int) to get the codepoint, and increment the...
Is there any easier way to do the following in c?
unsigned short check_str(char *str)
{
while (*str)
{
if (!(*str == ' ' || *str == '(' || *str == ')' ||
*str == '1' || *str == '2' || *str == 'a' ||
*str == 'x' || *str == 'b'))
return 0;
str++;
}
return 1;
}
...
I am trying to compare two formats that I expected would be somewhat compatible, since they are both generally strings. I have tried to perform strcmp with a string and std::wstring, and as I'm sure C++ gurus know, this will simply not compile. Is it possible to compare these two types? Is there an easy conversion here?
...
We have a function longest, which returns the longest substring that consists of letters. Example:
longest("112****hel 5454lllllo454")
would return: lllllo
However, when I run the program it seems to return lllllo454. Here is the function:
char *longest(char *s){
char *pMax = NULL;
int nMax = 0;
char *p = NULL;
int n...
ok, so ill cut to the chase here. and to be clear, im looking for code examples where possible.
so, i have a normal string, lets say,
string mystring = "this is my string i want to use";
ok, now that i have my string, i split it by the space with
string[] splitArray = mystring.Split(new char[] { ' ' });
ok, so now i have splitAr...
Possible Duplicate:
String vs string in C#
What's the difference between string and String, if any?
They both seem to perform the same funtion, but the casing is different. So, there are only TWO things that are different (that I know of) and they are:
When spelled with a capital letter, the color of its text is Blue in VStudi...
Hello, hopefully this should be a quick and simple one, using PHP I'm trying to split a string into an array but by only the last instance of whitespace. So far I have...
$str="hello this is a space";
$arr=preg_split("/\s+/",$str);
print_r($arr);
Array ( [0] => hello [1] => this [2] => is [3] => a [4] => space )
...which split...
I need to get the current time in a "HH:MM:SS"-format into a character array (string) so I can output the result later simply with a printf("%s", timeString);
I'm pretty confused on the timeval and time_t types btw, so any explanation would be awesome:)
EDIT:
So I tried with strftime etc, and it kinda worked. Here is my code:
time_t c...
I have some String variables which are getting the values from invoking the function getParameter() and some of this variables will probably be null.
Later, I will evaluate this variables using equals() method.
Should I set all the String variables to the empty String ("") if they are null to avoid any problems?
...
Given the 2 toString() implementations below, which is prefered
public String toString(){
return "{a:"+ a + ", b:" + b + ", c: " + c +"}";
}
or
public String toString(){
StringBuilder sb = new StringBuilder(100);
return sb.append("{a:").append(a)
.append(", b:").append(b)
.append(", c:").append(c)
...
Hey,
I am making a site in JRuby on Rails, I am using some Java classes as well.
I have a select form element which passes user selections to the controller.
The selections are passed like so:
Parameters: {"options"=>["Option One", "Option Two"]}
The Java method that I am using requires the options selected to be a String[] (Java S...
Funny as it can sound, I transformed my datatable data into a string which looks something
like this:
{ blocks: [
{"fromAge" : "60","fromAmount" : "0","toAge" : "64","toAmount" : "65000","color" : "red","orderNo" : "2"},
{"fromAge" : "66","fromAmount" : "0","toAge" : "72","toAmount" : "12000","color" : "red","orderNo" : "4"},
{"fromA...