Hi,
I'm trying to get Rails to capitalize the first character of a string, and leave all the others the way they are. I'm running into a problem where "i'm from New York" gets turned into "I'm from new york."
What method would I use to select the first character?
Thanks
EDIT: I tried to implement what macek suggested, but I'm getti...
I'm trying to format strings in XSLT that needs to be in camel case to be used appropriately for the application I'm working with.
For example:
this_text would become ThisText
this_long_text would become ThisLongText
Is it possible to also set this up where I can send an input to the format so I do not have to recreate the format mult...
Is there a preferred (not ugly) way of outputting a list length as a string? Currently I am nesting function calls like so:
print "Length: %s" % str(len(self.listOfThings))
This seems like a hack solution, is there a more graceful way of achieving the same result?
...
I'm using urllib2 to open a url. Now I need the html file as a string. How do I do this?
...
in my php I evaluate the the filesize
if (($width !=1600) || ($height
!=1100)) {
echo "wrongsize"; }
else { echo "justright"; }
in my file i try and evaluate the the response to update the html
'onComplete' :function(event, queueID, fileObj, response, data)
{
if(response == "wrongsize") {
$('div#uploadError').ht...
I have an .ascx file. This file has an associated .ascx.resx in multiple languages. I want to get a resource string for a specific CultureInfo. Ordinarily I'd use this.GetLocalResourceObject in the codebehind, but I don't want a local resource string, I want one for a specific language.
...
I read in a Byte Array generated from a function called from an external DLL file and then converted (encoded) it into a String. In the Locals window (shown below), msg does not have a trailing double-quote.
Is this a bug, glitch, or a sign something is wrong?
Code:
Dim msgC(32) As Byte
Dim msg As String, length As Integer = ...
I have a variable that reads as _123456 and I need to delete the underscore prefix on this variable before storing it to a field. How do I do this?
var value = "_123456"
...
Is there a limited-length string class around? I've searched a
little on the net and didn't find anything. I'm interested in a
class that limits (possibly at compile time) the length to 255,
so marshalling the string's length only requires one byte.
...
Using PHP I'd like to compare an actual ip address to part of one, and see if it matches.
For example I want to see if the address matches 12.34..
<?php
$rem_address = getenv('REMOTE_ADDR');
$temp = substr ($rem_address,0,6)
if ($temp == "12.34.") echo "It's a match";
?>
Is there an easier/better way to do this?
...
Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to write a conversion function that can take as an input an error code and return as an output a string literal representing the actual #define name.
As an example, if I have
#define NO_ERROR ...
Hi, I'm using this script to simply create an image from text. What I would like to know is how to save the image instead of printing straight to browser;
// an email address in a string
$string = $post[$key];
// some variables to set
$font = 4;
$width = ImageFontWidth($font) * strlen($string);
$height = Imag...
I'm a bit fuzzy on the basic ways in which programmers code differently in C and C++. One thing in particular is the usage of strings in C++ over char arrays, or vice versa. So, should I use strings or char arrays, in general, and why?
...
Hi,
I have a collection of hex strings that represent colours and I am binding a combobox's ItemsSource to that collection.
The combobox items are templated to have a filled rectangle with the relevant colour. I therefore need to use a converter to convert the hex value to a string. Easy enough.
However, Blend is telling me that this ...
(java 1.5)
I have a need to build up a String, in pieces. I'm given a set of (sub)strings, each with a start and end point of where they belong in the final string. Was wondering if there were some canonical way of doing this. This isn't homework, and I can use any licensable OSS, such as jakarta commons-lang StringUtils etc.
My com...
I faced a problem - I need to use a macro value both as string and as integer.
#define RECORDS_PER_PAGE 10
/*... */
#define REQUEST_RECORDS \
"SELECT Fields FROM Table WHERE Conditions" \
" OFFSET %d * " #RECORDS_PER_PAGE \
" LIMIT " #RECORDS_PER_PAGE ";"
char result_buffer[RECORDS_PER_PAGE][MAX_RECORD_LEN];
/...
Possible Duplicate:
C++: How to split a string?
Is there a way to tokenize a string in C++ with multiple separators? In C# I would have done:
string[] tokens = "adsl, dkks; dk".Split(new [] { ",", " ", ";" }, StringSplitOptions.RemoveEmpty);
...
Hi All,
I'm writing a program in C++ which do some special treatment for all the files in the current directory on Linux OS.
So i was thinking of using system calls such as system("ls") to get the list of all files.
but how to store it then inside my program ? ( how to redirect the output of ls to let's say a string that i decl...
Guys, I have a data structure which has 25 distinct keys (integer) and a value. I have a list of these objects (say 50000) and I intend to use a hash table to store/retrieve them. I am planning to take one of these approaches.
Create a integer hash from these 25 integer keys and store it on a hash table. (Yeah! I have some means to han...
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
string a;
cin>>a;
a.erase(a.end()-1);
a.erase(a.begin()+1);
string ge = "oae";
a.insert(a.begin()+1, ge);
cout<<a<<endl;
return 0;
}
It doesn't compile and i don't know why. Can you tell me what's wrong
...