I found this piece of code on the site, it seems the author is long gone, anyway, I'm having hard time understanding the actual swap and how the reverse occurs:
void strrev2(char *str)
{
if( str == NULL )
return;
char *end_ptr = &str[strlen(str) - 1];
char temp;
while( end_ptr > str )
...
I need to parse an extremely complex string of characters to extract a particular section of it, which contains a foreign key to a database (the snippet comes from a product called Interspire Email Marketer and contains some weird logic to filter a contact list).
The string in question is as follows (yes, I realize it's extremely weird....
I'm looking for a way to have an external file (resources, resx, assembly, config, xml, etc) editable by a user of my application.
These would mostly contains strings of text related to database field names and the like.
Preferably, something with an already existing free editor. I wouldn't mind doing an app for this if needed though.
...
I have a form that allows the user to either upload a text file or copy/paste the contents of the file into a textarea. I can easily differentiate between the two and put whichever one they entered into a string variable, but where do I go from there?
I need to iterate over each line of the string (preferably not worrying about newlines...
This is simple code designed to take a decimal number and return a string representing the equivalent in binary.
b2d :: Int -> String
b2d 1 = "1"
b2d x = show (x `mod` 2) ++ b2d x/2
However, when I try to run this through hugs, it gives me an error:
:3 - Instance of fractional [Char] required for definition of b2d
I don't know wh...
My App is MFC based and uses the CToolTipCtrl to implement Tool Tips. The Tool Tips are in a string table resource and each tool tip is loaded with LoadStringW. Try as I might I cannot get the Tool Tips to display over multiple lines. Each tool tips is displayed as a single line.
I tried adding \r\n &\n /\r/\n to the middle of a tool ...
What would an implementation of 'MagicFunction' look like to make the following (nunit) test pass?
public MagicFunction_Should_Prepend_Given_String_To_Each_Line()
{
var str = @"line1
line2
line3";
var result = MagicFunction(str, "-- ");
var expected = @"-- line1
-- line2
-- line3";
Assert.AreEqual(expected, result);
}...
I have a string, like a sentence, and I know for sure that there are many words with at least one space separate every adjacent two. How can I split the words into individual strings so I can loop through them?
EDIT:
Bash
The string is passed in as an argument. e.g. ${2} might be "cat '' cat '' file". so how can I loop through this ar...
I am interested if it's possible to do string encryption/decryption using Excel Visual Basic and some cryptographic service provider.
I have found a walkthrough Encrypting and Decrypting Strings in Visual Basic, but it seems it's valid for standalone Visual Basic only.
So would you suggest me another encryption method or show how the w...
What is the way to convert names to proper case in C#? I have a table with firstname and lastname in it. For Example mcdonalds to McDonalds, o'brien to O'Brien and so on.
...
function seems_utf8($str) {
$length = strlen($str);
for ($i=0; $i < $length; $i++) {
$c = ord($str[$i]);
if ($c < 0x80) $n = 0; # 0bbbbbbb
elseif (($c & 0xE0) == 0xC0) $n=1; # 110bbbbb
elseif (($c & 0xF0) == 0xE0) $n=2; # 1110bbbb
elseif (($c & 0xF8) == 0xF0) $n=3; # 11110bbb
elseif (($c & 0xFC) == 0xF8) $n=4; # 111110bb
...
say a string might be like "a b '' c '' d", how can I check that there is single/double quote and space contained in the string?
...
Hello All,
How to insert a string enclosed with double quotes in the beginning of the StringBuilder and String?
Eg:
StringBuilder _sb = new StringBuilder("Sam");
I need to insert the string "Hello" to the beginning of "Sam" and O/p is "Hello Sam".
String _s = "Jam";
I need to insert the string "Hello" to the beginning of "Jam" an...
I'm trying to create a select box drop down with a twist,
Basically this is an Ajax form that when an item is selected from the list it'll add it into a text field. However I also want to add a few extra selections in here.
the string I'm getting is made up of COMPANY_SITE_DEPARTMENT and for example SDGCC_NEWTOWN_INBOUND.
Using PHP I ...
I've been struggling for a couple of days now with the following...
I'm trying to find a way to instantiate a number of objects which I can name via a raw_input call, and then, when I need to, look at its attributes via the 'print VARIABLE NAME' command in conjunction with the str() method.
So, to give an example. Let's say I want to ...
i have a text string in the following format
$str= "word1 word2 word3 word4 "
So i want to seperate each word from the string.Two words are seperated by a blank space
How do i do that. IS there any built in function to do that?
...
I am uploading a image file to the server.
Now after uploading the file to the server I need to rename the file with an id, but the extension of the file should be retained.
Eg: if I upload the file image1.png then my server script should retain the extension .png. But I need to change the substring to some other substring (primary key ...
I want to do following 2 things
1)i want retrive the list of all files in a directory
2)and then i want to remove their extensions
eg: if i get a list of fils as A.png ,B.png,C.jpeg,D.txt
I want to get A,B,C,D
How do i do that in php?
...
hello,
I want to the bits (0 or one) from a byte in a string but I don't know how?
Thanks.
...
A program has users typing in a comma-delimited string into an array:
basketball, baseball, soccer ,tennis
There may be spaces between the commas or maybe not.
If this string was simply split() on the comma, then some of the items in the array may have spaces before or after them.
What is the best way of cleaning this up?
...