string

Java clearing the string buffer after loop

How do you clear the string buffer in Java after a loop so the next iteration uses a clear string buffer? ...

How to implement a variable-length ‘string’-y in C

I’ve googled quite a bit, but I can’t find information on how variable-length strings are generally implemented in higher-level languages. I’m creating my own such language, and am not sure where to start with strings. I have a struct describing the string type, and then a create function that allocates such a ‘string’: /* A safer `str...

String comparison in .Net: "+" vs "-"

I always assumed that .Net compares strings lexicographically, according to the current culture. But there is something strange when one of the strings ends on '-': "+".CompareTo("-") Returns: 1 "+1".CompareTo("-1") Returns: -1 I get it an all cultures I tried, including the invariant one. Can anyone explain what is going on, and how...

How to serialize a DataTable to a string?

Recently I was in the need to serialize a DataTable as a string for further processing (storing in a file). So I asked myself: How to serialize a DataTable into a string? ...

C# Split A String By Another String

I've been using the Split() method to split strings, but this only appears to work if you are splitting a string by a character. Is there any way to split a string, with another string being the split by parameter? I've tried converting the splitter into a character array, with no luck. In other words, I'd like to split the string "TH...

String literals in C

A quick question... What is the type of string literal in C ? Is it char * or const char * or const char * const ? ...

Convert string to datetime to year and month SQL

Hi How do i get the year(2009) and month(12) from the string datetime, following give me correct full date but wrong year (1905-07-03 00:00:00.000) and month (1900-01-13 00:00:00.000). I have tried changing YYYY to year and MM to month. Declare @date dateTime; Declare @CurrentYear datetime; Declare @CurrentMonth datetime; Select @date ...

Python String Method Conundrum

The following code is supposed to print MyWords after removing SpamWords[0]. However; instead of returning "yes" it instead returns "None". Why is it returning "None"? MyWords = "Spam yes" SpamWords = ["SPAM"] SpamCheckRange = 0 print ((MyWords.upper()).split()).remove(SpamWords[SpamCheckRange]) ...

Comparing list of strings with an available dictionary/thesaurus

Hi all I have a program (C#) that generates a list of strings (permutations of an original string). Most of the strings are random grouping of the original letters as expected (ie etam,aemt, team). I wanna find the one string in the list that is an actual English word, programatically. I need a thesaurus/dictionary to look up and comp...

With Perl, how do I read records from a file with two possible record separators?

Here is what I am trying to do: I want to read a text file into an array of strings. I want the string to terminate when the file reads in a certain character (mainly ; or |). For example, the following text Would you; please hand me| my coat? would be put away like this: $string[0] = 'Would you;'; $string[1] = ' please hand me...

iPhone NSURLConnection: connectionDidFinishLoading - how to return a string to the calling method.

Hi Guys, Could you please help me? I have reviewed similar stackoverflow questions/answers to this but I am still stumped. I'm a beginner and I'm really struggling with this. With the iPhone, I can download XML from a URL but I cannot store the result string in a NSString variable and see it from the calling function. I have the follo...

How do I download the source code of a web page and then stick it in SAX parser as a whole?

I just want to download the source as a string. Then stick that XML (which is currently a string) into a parser. ...

How do you append to an already existing string?

I want append to a string so that every time I loop over it will add say "test" to the string. Like in PHP you would do: $teststr = "test1\n" $teststr .= "test2\n" echo = "$teststr" echos: test1 test2 But I need to do this in a shell script ...

Javascript string matching pattern help

Hi guys, i need to find few words or matching pattern using a Javascript. this is the requirement. i have a string like this, Here is a quick guide for the next time you reach for your favorite oil and some other topics and i need to match this string against a string like this favorite oil and some other topics can be based...

get the selected text fragment using Javascript

guys, image attached in this post is from a web page. i have a span to highlight text fragments in the web page using javascript. (green color span in the pic) so when now when i select some content from the webpage, (highlighted in light-blue) how do i get the section selected from green color span? in this case "been considered a...

Under what circumstances is it necessary to perform an explicit cast of a variable to a string in JavaScript?

Are there any scenarios where it is absolutely necessary to perform an explicit cast of a variable in JavaScript to a String In the following example it is not necessary: var n=1; var s = "Hello" + n; var s = "Hello"+String(n); //not necessary I've used a numeric value above, although this need not apply only to numerics. ...

Entering a string of characters using arrays and pointers

Ok guys, i'm very beginner and trying to enter string to a char array using pointers..and then display what i've written. There're two things i want to ask about. First , if i didn't want to specify a size for the array and just want it to expand to contain all string i've entered ..how is that ? And second after i enter the string and...

Vbscript. Variable looses its content?

...

Array to String Back to Array Conversion Problem

I'm saving a bunch of ID's to the session like this. session[:id_group] = 1,2,3,4,5 Because I need to save them to a data base with a form. In that form I have hidden-field : <%= form.text_field :group, :value => session[:id_group].inspect%> I use the inspect so that the value saved to the database gets to be [1,2,3,4,5] and not 1...

Can I multiply strings in java to repeat sequences?

I have something like the following: int i = 3; String someNum = "123"; I'd like to append i "0"'s to the "someNum" string. Does it have some way I can multiply a string to repeat it like Python does? So I could just go: someNum = sumNum + ("0" * 3); or something similar? Where, in this case, my final result would be: "123000"....