So, I have a value of type __be16 (2 bytes). In hex, the value is represented as 0x0800 or 2048 in decimal. (16^2 * 8)
So, when I printf this; I do this:
printf("%04X", value); //__be16 value;
//Print a hex value of at least 4 characters, no padding.
output:
0008
printf("%i", value); //Print an integer.
ou...
I want to be able to use a RegEx to parse out ranges like a Windows Print dialog (such as 1-50,100-110,111,112). The following is my current code and I am not clear on how to parse for the additional commas and numbers. I can parse out the hyphen, but not sure how to do it for additional commas or hyphens
private void tboxRowNum_Leave(o...
My html page sends an ajax request (POST) to PHP, PHP echo a json object.
Code has been tested and worked fine at my development view.
However, after they are uploaded to a VPS hosting server, the returned json string is empty (I used alert() at the response function to display the responseText and found out it was empty).
Could som...
Typical strlen() traverse from first character till it finds \0.
This requires you to traverse each and every character.
In algorithm sense, its O(N).
Is there any faster way to do this where input is vaguely defined.
Like: length would be less than 50, or length would be around 200 characters.
I thought of lookup blocks and all but d...
I was wondering if any one could explain this code to me...
public void SomeMethod()
{
StringBuilder sb = new StringBuilder();
AppendFoo(sb);
String foo = sb.ToString(); // foo is "foo"
String s = String.Empty;
AppendBar(s);
String bar = s; // bar is empty
}
public void AppendFoo(StringBuilder x)
{
x.Appen...
If I need a string to match this pattern: "word1,word2,word3", how would I check the string to make sure it fits that, in PHP?
I want to make sure the string fits any of these patterns:
word
word1,word2
word1,word2,word3,
word1,word2,word3,word4,etc.
...
Hello all. I'm trying to write a string routine in C, and I keep hitting on the same issue.
In C, I have this string:
MAMAAMAAALJ
If I have this string:
AAA
How can I determine that AAA is inside of MAMAAMAAAJ?
...
I want to reverse the string like this: "How are you" -> "you are How"
Those are the code I typed, it could reverse the string ,
but it still has comma between strings like "you,are,How"
var str = window.prompt("Enter a string");
var tokens = str.split( " " );
document.writeln( tokens.reverse() );
...
Gotten a hold on how to fetch and write to variables in Objective-C, now it's time to learn how to do something more useful with them! Right now, I'm primarily trying to figure out how string manipulation works. In particular, I'm looking for the following functions:
Concatenation
Finding the length of a string (especially multi-byte...
I want to accept a list of character as input from the user and reject the rest. I can accept a formatted string or find if a character/string is missing.
But how I can accept only a set of character while reject all other characters. I would like to use preg_match to do this.
e.g. Allowable characters are: a..z, A..Z, -, ’ ‘
User must ...
I have an two dimension array that contains strings and want to create a LaTeX table with them.
The problem is that they could be longer and there has to be line breakes after 15 characters. The
Say it's a 2x2 array with contains {{"String11.......String11", "String21"}, {"String12.......String12.......String12.......", "String22.........
c++:
int main()
{
string a = "a";
... ...
}
when i debug in gdb:
(gdb) set var a = "ok"
Invalid cast
I run the program and pause at a break point after string a has been initialized. I'm trying to set its value, but it complains about invalid cast. What's the proper syntax for this?
...
int main()
{
cout << "Buy or sell (b/s): " << endl;
string buy_sell;
cin >> buy_sell;
.....
}
when i try to step through this in Xcode, i just stops at the cin >> buy_sell line, because it's waiting for the user input. How do i enter the value i want in the debugger so i can move past this? I'm using Xcode 3.2.1.
(I k...
i have a string like 123Prefix1pics.zip
i want to split it into 123 Prefix1 pics.zip and store them in different variables
i m trying to do it in c#,.net
jst litle bit confused on how to use split method
...
I would like to read out the classnames attached to a certain element and take action based on that the classname contains a certain value ("active"). The classname could be something like: class="bla-bla-bla first active". What is the best way to do that?
...
Hi.
This might be a very stupid question :P But I found this really interessting:
class SomeClass{
var $var = "this is some text";
function echoVar($name){
echo $this->{$name};
}
}
$class = new SomeClass()
$class->echoVar("var") // will echo "this is some text"
Can I do somethign similar, can I take the value of a string and inst...
Hi Gang,
I have a inefficiently constructed form that is obviously sending one type of data per SELECT element. For simplicity's sake, here's an example.
The form posts data from 2 SELECT elements, but it actually needs to contain 3 pieces of data. To the user, the SELECTs do contain 3 pieces of data; one SELECT denotes quantity and th...
I'm making an Arduino-powered clock, and in the process, I'm trying to format integers into two-digit formatted strings for the time read-out (e.g. 1 into "01").
The following gives me "error: expected primary-expression before '{' token":
char * formatTimeDigits (int num) {
char strOut[3] = "00";
if (num < 10) {
strOut = {'0',...
This is a question:
"Where is the car?"
This is NOT a question:
"Check this out: http://domain.com/?q=test"
How do I write a function to analyze a string so that we know for sure it is a question and not part of a URL?
...
How can I check if one string contains another substring in Javascript?
Usually I would expect a String.contains() method, but there doesn't seem to be one.
Edit : thanks for all the answers :) however it seems that I have another problem :(
when I use the ".indexof" method, Firefox refuses to start the javascript (this is for an ext...