Using the .NET MicroFramework which is a really cut-down version of C#. For instance, System.String barely has any of the goodies that we've enjoyed over the years.
I need to split a text document into lines, which means splitting by \r\n. However, String.Split only provides a split by char, not by string.
How can I split a document...
Is it possible to remove duplicate characters from a string without saving each character you've seen in an array and checking to see if new characters are already in that array? That seems highly inefficient. Surely there must be a quicker method?
...
Here's the snippet:
Function Encode(ByVal dec As String) As String
Dim bt() As Byte
ReDim bt(dec.Length)
bt = System.Text.Encoding.ASCII.GetBytes(dec)
Dim enc As String
enc = System.Convert.ToBase64String(bt)
Return enc
End Function
I'm trying to make an program that sends a...
Hello,
I found some table valued function for splitting string in sp and getting values in columns,
but when data is huge these functions are became slow. so if anybody has a good function for splitting values separated by commas into rows of a table... please provide me.
The link where I found some functions: Click Here
...
I want to create a function that will take a string and an integer as parameters and return a string that contains the string parameter repeated the given number of times.
For example:
std::string MakeDuplicate( const std::string& str, int x )
{
...
}
Calling MakeDuplicate( "abc", 3 ); would return "abcabcabc".
I know I can do t...
CSS:
.dynamicDiv {
width:200px;
border:solid 1px #c0c0c0;
background-color:#e1e1e1;
font-size:11px;
font-family:verdana;
color:#000;
padding:5px;
}
Javascript:
//create array
var myNames=new Array();
//var nameString=document.getElementById(myNames.toString())
function addToDiv()
...
I need to evaluate the response of a Ajax.Request (using prototype) with a switch statement:
new Ajax.Request('http://localhost/somescript.php',{method:'post',parameters:params,onSuccess:
function(response)
{
var result = response.responseText;
switch (result)
{
case "ok":
//do som...
I'm looking for a short, simple suffix tree building/usage algorithm in Java. The best I've found so far lies withing the Semantic Discovery Toolkit, but the implementation is several thousand lines long and spans several classes. Ideally, the implementation would be as short as possible and span no more than a few hundred lines.
Does a...
I'm fetching a web page using the Apache httpcomponents Java library. After connecting the result I get is an HttpEntity which has a method getContent() which returns an InputStream and also has a method writeTo() which writes to an OutputStream.
I want to turn the result into a String for extracting information. What is the most elegan...
Ok folks I have bombed around for a few days trying to find a good solution for this one.
What I have is two possible address formats.
28 Main St Somecity, NY 12345-6789
or
Main St Somecity, Ny 12345-6789
What I need to do Is split both strings down into an array structured as such
address[0] = HousNumber
address[1] = Street...
I need to figure out the pixel length of an NSString in Cocoa on OSX and I have found a couple of links that describe how to do this using the IPhone sdk but I didn't see anything about how to do this when not targeting the IPhone. Can anyone link me to some docs that would be relevant. I did find anything in the NSString docs.
...
I would like to call the following bash command in MATLAB:
grep "Up to" ~/test_linux/vision1.1/log | awk '{print $7}'
I use system() in MATLAB, but it turns out to have errors:
>> [status string]=system('grep "Up to" ~/test_linux/vision1.1/log | awk '{print $7}' ');
??? [status string]=system('grep "Up to" ~/test_linux/vision1.1...
I've just been using this code to check if a string is empty:
if ($str == "")
{
// ...
}
And also the same with the not equals operator...
if ($str != "")
{
// ...
}
This seems to work (I think), but I'm not sure it's the correct way, or if there are any unforeseen drawbacks. Something just doesn't feel right about it.
...
Does anyone have a simple tool that can convert a non-escaped string to an escaped string?
For example, I'm trying to paste the following data into a Java String datatype:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
I manually have to add the slashes:
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
Then...
Hello,
Where i can save string , and when program run, user can change it -overrride. (not config file, i do not want that anybody can see what written).
Many thanks.
...
I am wanting to use "keywords" within a large string. These keywords start and end using *my_keyword* and are user defined. How, within a large string, can I search and find what is between the two * characters and return each instance?
The reason it might change it, that parts of the keywords can be user defined, such as *page_date_Y...
Hi,
i have a string like this:
blablablamorecontentblablabla?name=michel&score=5&age=28&iliedabouttheage=true
looks like a regular querystring yes, but i'm not in any web context
now i want to extract the values (after the = sign) by their key , for example,what is the name (michel), the score(5), the age(28) etc.
Normally i parse t...
This question has been asked so many times for so many different languages, with some fascinating answers. I propose compiling the answers here so we can compare them side by side.
Also, how is it done in the languages not yet "covered" by a question on SO?
One programming language or idiom per answer, please.
...
I'm looking for the best approach for string find and replace in Java.
This is a sentence: "My name is Milan, people know me as Milan Vasic".
I want to replace the string Milan with Milan Vasic, but on place where I have already Milan Vasic, that shouldn't be a case.
after search/replace result should be: "My name is Milan Vasic, peo...
Given this code:
has_many :foos, :finder_sql = <<-SQL
select * from foos where bars = #{id}
SQL
The #{id} part is being prematurely interpolated.
How do I escape it?
Thanks.
...