string

Strip Byte Order Mark from string in C#

Hi, I've read similar posts on this and they don't answer my question. In C#, I have a string that I'm obtaining from WebClient.DownloadString. I've tried setting client.Encoding to new UTF8Encoding(false), but that's made no difference - I still end up with a byte order mark for UTF-8 at the beginning of the result string. I need to re...

How to declate a wide char constant in an IDL

We are migrating our C++ COM application to be unicode, and as part of this migration we want to migrate the constant strings in our IDL to unicode as well. The problem is that at the moment, we still compile it both in ANSI and in UNICODE, which means that we can't use the L"String" construct to declare wide charts. At the moment, our...

Convert String containing several numbers into integers

I realize that this question may have been asked several times in the past, but I am going to continue regardless. I have a program that is going to get a string of numbers from keyboard input. The numbers will always be in the form "66 33 9" Essentially, every number is separated with a space, and the user input will always contain a d...

Datamapper DateTime to String behaviour

I write my first project wich using Datamapper as ORM, so please be patient. :) I try to do get String from DateTime field: Error.first.submitted_at.to_s => "2009-08-24T12:13:32+02:00" Returned String is not good for me. In ActiveRecord I can do something like that: Error.first.submitted_at.to_s(:only_date) or any other da...

String Between Function?

Is there a way to get the string between.. lets say quote " The problem with using Indexof and substring is that it gets the first " and last " but not the pair. Like "Hello" "WHY ARE" "WWWWWEEEEEE" It will get Hello" "WHY ARE" "WWWWWEEEEEE I want it to get to array > Hello, WHY ARE, WWWWEEEEEE Is there any way to do this? ...

Finding a string in a string

Hi, Does anyone know a nice efficient way of finding a string within a string (if it exists) in objective c for iPhone Development, I need to find the part of the string in between two words, e.g. here I need to find the co2 rating number in the string, where z is the value I'm looking for ... xxxxxco_2zendxxxxxxx Thanks Richard www...

Finding "closest" strings in a Python list (alphabetically)

Hello, I have a Python list of strings, e.g. initialized as follows: l = ['aardvark', 'cat', 'dog', 'fish', 'tiger', 'zebra'] I would like to test an input string against this list, and find the "closest string below it" and the "closest string above it", alphabetically and case-insensitively (i.e. no phonetics, just a<b etc). If the...

Longest Non-Overlapping Substring

I wonder if anyone knows the (optimal?) algorithm for longest recurring non-overlapping sub string. For example, in the string ABADZEDGBADEZ the longest recurring would be "BAD". Incidentally if there is no such result, the algorithm should alert that such a thing has occurred. My guess is that this involves suffix trees. I'm sure th...

.NET / C# - Convert char[] to string

Guess I have just never run across it before. What is the proper way to turn a char[] into a string? The ToString() method from an array of chars doesn't do the trick. Guess I had always imagined that was what it was for. ...

Adding variables together using Actionscript

Hi Everyone - I am trying to translate this statement into Actionscript: "Sally is 5 years old. Jenny is 4 years old. The combined age of Sally and Jenny is 9 years." This is what I have so far: function getAges (sallyAge:Number,jennyAge:Number,combinedAge:Strin g) { trace("Sally's Age:" + sallyAge); trace("Jenny's Age:" + jennyAge); ...

Parsing DateTime strings

Hi, I'm having some difficulties parsing strings of DateTime using DateTime.ParseExact. DateTime result; CultureInfo provider = CultureInfo.InvariantCulture; // Parse date-only value with invariant culture. //format = "mm/dd/yyyy"; format = "d"; try { result = DateTime.ParseExact(data+" 12:00:00 AM", forma...

String to Stategy in Strategy Pattern

I'm working in AS3, but I guess this could be a general question, so I'll frame it more vaguely... I'm using an XML file to define parameters for a particular class of object that implements the Strategy Pattern. There will be large variety of objects, and this works for us as a designer friendly solution to customizing these objects. A...

writing text in textfile and saving it using saveDialog

hi , i have a little confusion.. i want to write a string in a text file which should be dynamically saved by the saveDialog i have done this task statically.. means file with specified file name is created and text is also written from jTextArea.. but i wnt to save this file on my given location and with my given name.. can u please gu...

Java Replacing multiple different substring in a string at once (or in the most efficient way)

I need to replace many different sub-string in a string in the most efficient way. is there another way other then the brute force way of replacing each field using string.replace ? ...

Need to parse a string, having a mask (something like this "%yr-%mh-%dy"), so i get the int values.

For example i have to find time in format mentioned in the title(but %-tags order can be different) in a string "The date is 2009-August-25." How can i make the program interprete the tags and what construction is better to use for storing them among with information about how to act with certain pieces of date string? ...

Is there a Java function which parses escaped characters?

I'm looking for a built-in Java functions which for example can convert "\\n" into "\n". Something like this: assert parseFunc("\\n") = "\n" Or do I have to manually search-and-replace all the escaped characters? ...

What does 'string is not terminated' mean?

Hello, Excuse my ignorance, but I don't know what the phrase means. I have a few questions: is there any difference between 'string is not terminated' and 'string is not null terminated'? What is it? How does a non terminated string look like? Thank you! ...

Strings joining and complexity?

When I need to join two strings I use String.Format (or StringBuilder if it happens in several places in the code). I see that some good programmers doesn't give attention to strings joining complexity and just use the '+' operator. I know that using the '+' operator make the application to use more memory, but what about complexity? ...

The First Column of the excel file to put in string variable C# ?

What i need id to take the first column of an excel file and put that column in a string variable but numbers that will be taken from excel to be separated with blank space. For Example: Excel file: 1 3 4 56 76 7 876 23 43 (in column) and string in C# string number = "1 3 4 56 76 7 876 23 43" Any code will help me I have made th...

implementing a string translation table in c

I want to implement a basic search/replace translation table in C; that is, it will read in a list of pairs of words from a config file, and go through a text received at runtime, replacing each source word it finds with the corresponding target word. For example, if my user-input text was "Hello world, how are you today?" and my conf...