I am writing a little game in which the user is asked for their race and class.
There are five possible races of string[5] and four possible classes of string[9].
How do I program pascal to 1. define the five races and four classes as constants, 2. check the user input to see whether the input is within the possible races and classes -...
How does one parse an integer to string(char* || char[]) in C? Is there an equivalent String parseInt(int) method from Java in C?
...
This is good:
import string
string.capwords("proper name")
'Proper Name'
This is not so good:
string.capwords("I.R.S")
'I.r.s'
Is there no string method to do capwords so that it accomodates acronyms?
...
I need to match up two almost-the-same long freetext strings; i.e., to find index-to-index correspondences wherever possible.
Because this is freetext, the comparison should not be line-based as in code diffing.
Any suggestions for Java libraries?
A simple example (In real life , of course, there would not be extra whitespace to lin...
What I am trying to achieve is to merge three strings. Two are provided as strings; firstname and lastname, while the third is a simple comma/space separator. Given the following lines of code:
//Working code
var sep = ", ";
var fullName = myNewBO[0].LastName + sep + myNewBO[0].FirstName;
//Erronous code
var fullName = myNewBO[0].LastN...
I tend to make the length of character strings some power of two (16, 32, 64). Is there any optimaztion benefit in doing this for objects of type string such as a string variable, a collection of strings, or a column in a database of type string? This is in a .net/sql server environment.
...
I want to write a function that reverses the given string passed into it.
But, I can not. If I supply the doReverse function (see code below) with a character array, my code works well.
I can't figure out why this does not work.
I am able to access str[0] in doReverse, but I can't change any value of the array by using a char pointer. A...
I am not familiar with PHP at all and had a quick question.
I have 2 variables @pricePerUnit and @invoicedUnits. Here's the code that is setting these to values:
$InvoicedUnits = ((string) $InvoiceLineItem->InvoicedUnits);
$pricePerUnit = ((string) $InvoiceLineItem->PricePerUnit);
If I output this, I get the correct values. Lets say ...
I have a function that accepts a char* as one of its parameters. I need to manipulate it, but leave the original char* intact. Essentially, I want to create a working copy of this char*. It seems like this should be easy, but I am really struggling.
My first (naive) attempt was to create another char* and set it equal to the original...
Reporting services use format strings to auto format cell data. For example "c2" formats a cell to be displayed as currency with a decimal precision of 2.
Does anyone know where I'd find a comprehensive list off all the different formats available?
...
Can I simply use
if(myString == nil)
For some reason a string that I know is null, is failing this statement.
...
Can I make an assumption that given
std::string str;
... // do something to str
Is the following statement is always true?
(str.empty() == (str == ""))
...
I am looking for ways to find matching patterns in lists or arrays of strings, specifically in .NET, but algorithms or logic from other languages would be helpful.
Say I have 3 arrays (or in this specific case List(Of String))
Array1
"Do"
"Re"
"Mi"
"Fa"
"So"
"La"
"Ti"
Array2
"Mi"
"Fa"
"Jim"
"Bob"
"So"
Array3
"Jim"
"Bob"
"So"
"La"
"...
I am trying to read data off of a Windows serial port through Java. I have the javax.comm libraries and am able to get some data but not correct data. When I read the port into a byte array and convert it to text I get a series of characters but no real text string. I have tried to specify the byte array as being both "UTF-8" and "US-...
Why is the following code (in cocoa) not working?
NSString *extension = [fileName pathExtension];
NSString *wantedExtension = @"mp3";
if(extension == wantedExtension){
//work
}
in Xcode this just runs without warnings or errors but doesn't do what I think it SHOULD do.
...
Sorry to start another of those unanswerable questions on SO, but I'm just curious as to the pros and cons of all the different string types in C++. My particular question is between MFC's CStrings and std::string (since I'm doing Windows only software), but this would extend to any of the string formats in C++. What do you all thing i...
I need to write an algorithm that returns the closest match for a contact based on the name and address entered by the user. Both of these are troubling, since there are so many ways to enter a company name and address, for instance:
Company A, 123 Any Street Suite 200, Anytown, AK 99012
Comp. A, 123 Any St., Suite 200, Anytown, AK 9901...
I'm looking for a data structure to store strings in. I require a function in the interface that takes a string as its only parameter and returns a reference/iterator/pointer/handle that can be used to retrieve the string for the rest of the lifetime of the data structure. Set membership, entry deletion etc. is not required.
I'm more co...
I have several functions in my program that look like this:
void foo(int x, int y)
Now I want my program to take a string that looks like:
foo(3, 5)
And execute the corresponding function. What's the most straightforward way to implement this?
When I say straightforward, I mean reasonably extensible and elegant, but it shouldn't t...
I have the following situation:
There is a tool that gets an XSLT from a web interface and embeds the XSLT in an XML file (Someone should have been fired). "Unfortunately" I work in a French speaking country and therefore the XSLT has a number of words with accents. When the XSLT is embedded in the XML, the tool converts all the accents...