I'm having troubles understanding this. I have a dictionary, where the key is a tuple consisting of two strings. I want to lowercase the first string in this tuple, is this possible?
"My Testtext TARGETSTRING My Testtext"
"My Testtext targetstring My Testtext"
Perl supports the "\L"-operation which can be used in the replacement-string.
The Pattern-Class does not support this operation:
Perl constructs not supported by this class: [...] The preprocessing operations \l \u, \L, and \U. http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
Is there a function built into Java that capitalizes the first character of each word in a String, and does not affect the others?
Miles O'Brien(B remains capital, this rules out Title Case)
Old McDonald would be find too, but I don't expect it to be THAT smart.)
A quick look at the Java String Documentation reveals only
toLowerCase(), which of course do not provide the desired behavior. Naturally, Google results are dominated by those two functions. It seems like a wheel that must have been invented already, so it couldn't hurt to ask so I can use it in the future.
I am trying to make a string alternate between upper and lower case letters. My current code is this:
def skyline (str1): result = '' index = 0 for i in str1: result += str1[index].upper() + str1[index + 1].lower() index += 2 return result
When I run the above code I get an error saying
String index out of range. How can I fix this?
I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ sourcecode, but that shouldn't matter). Bonus points for ignoring CVS and SVN control files/folders. Preferred way would be a shell script, since shell should be available at any Linux box.
There were some valid arguments about details of the file renaming.
I think files with same lowercase names should be overwritten, it's the user's problem. When checked out on a case-ignoring file system would overwrite the first one with the latter, too.
I would consider A-Z characters and transform them to a-z, everything else is just calling for problems (at least with source code).
The script would be needed to run a build on a Linux system, so I think changes to CVS or SVN control files should be omitted. After all, it's just a scratch checkout. Maybe an "export" is more appropriate.