I want to make a binary serialize of an object and the result to save it in a database.
Person person = new Person();
person.Name = "something";
MemoryStream memorystream = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(memorystream, person);
How can I transform memorystream in a string type to be saved ...
Hi Alls,
I'd like to remove one char from a string like this:
string = "ASDFVGHFJHRSFDZFDJKUYTRDSEADFDHDS"
print len(string)
(33)
So i would like to remove one random char in this string, and then have a len = 32
What's the best way to do so ?
EDIT: thanks for your answers, but i forgot something:
i'd like to print the char remove...
Javascript: I have the DOM representation of a node (element or document) and I'm looking for the string representation of it. E.g.,
var el = document.createElement("<p>");
el.appendChild(document.createTextNode("Test");
should yield:
get_string(el) == "<p>Test</p>";
I have the strong feeling, that I'm missing something trivially s...
I'm developing a program that I'm using a string(generatedCode) that contains some \n to enter a new-line at the textBox that I'm using it(textBox1.Text = generatedCode), but when I'm running the program, instead of breaking that line I'm seeing a square.
Remember that I've set the Multiline value of the textBox to True.
...
Is there a python class equivalent to ruby's StringScanner class? I Could hack something together, but i don't want to reinvent the wheel if this already exists.
...
With the assistance of others, I have redone the code from scratch due to them pointing out numerous errors and things that wouldn't work. Thus I have changed the code massively.
I have the program working other than two formatting settings that I can't figure out how to get to work.
I need to only print "DAILY SCOOP REPORT" once at ...
Hi, I'm just curios as to whether there is something built into either the c# language or the .net framework that tests to see if something is an integer
if (x is an int)
// Do something
It seems to me that there might be, but I am only a first-year programming student, so I don't know.
...
What's the simplest way, given a string:
NSString *str = @"Some really really long string is here and I just want the first 10 words, for example";
to result in an NSString with the first N (e.g., 10) words?
EDIT: I'd also like to make sure it doesn't fail if the str is shorter than N.
...
Ok,I am trying to compare two strings every 15 seconds and then update an info box.
Here is the code I have so far to get a text document from the web and store it into a string:
public String GetData(String url)
{
WebRequest request = WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
...
Hi guys
I'm trying to maniplulate a string without making a big issue out of it and spreading it out onto multiple lines, so I'm using some chaining to achieve this. The question I have is, how do I use string.Substring() to drop the last character off my string in this context?
In PHP I can pass a negative number as an argument (i.e. ...
This is what I am trying to do:
1 - I have an array with a string.
$photographer_array = "'Alberto Korda', 'Annie Leibowitz', 'Ansel Adams'";
2 - I am trying to populate an array with that string.
array($photographer_array);
What it is doing is creating an array with one single entry including all the commas. Why is it reading the...
I need some code for ActionScript 3.0 which will remove any characters which are not valid in an XML attribute.
Have spent some time searching google and not found what I'm after.
Can anybody help me out?
...
Hi,
I have strings with space seperated values and I would like to pick up from a certain index to another and save it in a variable. The strings are as follows:
John Doe Villa Grazia 323334I
I managed to store the id card (3rd column) by using:
if (line.length > 39)
{
idCard = line.Substring(39, 46);
}
Howev...
I was wondering if somebody could help me use string split to get all occurrences of text in between <p> </p> tags in an HTML document?
...
I have a string vaguely like this:
foo,bar,c;qual="baz,blurb",d;junk="quux,syzygy"
that I want to split by commas -- but I need to ignore commas in quotes. How can I do this? Seems like a regexp approach fails; I suppose I can manually scan and enter a different mode when I see a quote, but it would be nice to use preexisting librarie...
I want to get a collection of Product entities where the product.Description property contains any of the words in a string array.
It would look something like this (result would be any product which had the word "mustard OR "pickles" OR "relish" in the Description text):
Dim products As List(Of ProductEntity) = New ProductRepository(...
Hi,
I need to connect to a MySQL database via C# express 2008. I think I got the code right apart from the connection string. I obtained this code from a forum but the connection string was for SQLExpress 2005. Can someone please help me on how can I fix this? Here is the code with the SQL Express connection string:
//string connection...
I have a function that takes an object of a certain type, and a PrintStream to which to print, and outputs a representation of that object. How can I capture this function's output in a String? Specifically, I want to use it as in a toString method.
...
Does anyone know of a library for encoding a number of primitive types (like integers, floats, strings, etc) into a string but preserving the lexicographical order of the types?
Ideally, I'm looking for a C++ library, but other languages are fine too. Also, one can assume that the format does not need to be encoded in the string itself ...
In Go, string is a primitive type, it's readonly, every manipulation to it will create a new string.
So, if I want to concatenate strings many times without knowing the length of the resulting string, what's the best way to do it?
The naive way would be:
s := "";
for i := 0; i < 1000; i++ {
s += getShortStringFromSomewhere();
}
r...