•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,563 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,705 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 3078 | Replies: 3
![]() |
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,134
Reputation:
Rep Power: 10
Solved Threads: 257
replace() method is for switching characters or character seqeuances. However your example shows switching of strings/regular expresions so there is no point in using it. In this case you should use replaceAll(String regex, String replacement) .You have to be carefull with it, as it will be replace any matching expresion with your replacement string.
For second question you have to locate first the word of which you wish to change first character and can do something like this
Note please, that String str was in this case declared, where in your case you will have to locate it somehow!
String strName = "My name is"; String expression = "is"; String replacement = "is Michael"; String strName2 = strName.replace(expression, replacement);
For second question you have to locate first the word of which you wish to change first character and can do something like this
String str = "david"; String str2 = str.replaceFirst( Character.toString(str.charAt(0)), Character.toString(str.charAt(0)).toUpperCase() );
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
For the second Q, this http://www.techonthenet.com/oracle/f...ns/initcap.php should do the job
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,134
Reputation:
Rep Power: 10
Solved Threads: 257
Problem is that michael did not mentioned any DB usage and the recomended answer by you is only for Oracle/PLSQL.Also this function change all words to start with capital letter where from michael post I got impression that he want to do it only on certain words.
However you had a valid sugestion
However you had a valid sugestion
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
Similar Threads
- How to Remove Newline character from a VB String (Visual Basic 4 / 5 / 6)
- String replacement in a file (Perl)
- Howto | mssql seach and replace? (MS SQL)
- Update to completly lost : ) (Java)
- Text box question (C#)
- search and replace (Java)
- Problem with String replaceAll method (Java)
- Conver int Array into a String (Java)
Other Threads in the JSP Forum
- Previous Thread: query to populate a drop-down
- Next Thread: jsp-struts using validations



Linear Mode