|
-
Aug 6th, 2008, 06:12 AM
#1
Thread Starter
PowerPoster
[RESOLVED] How Can I replace Enter chars in a string
Hi Guys,
Please show me how to replace enter characters in a string
-
Aug 6th, 2008, 09:36 AM
#2
Re: How Can I replace Enter chars in a string
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 7th, 2008, 01:57 AM
#3
Thread Starter
PowerPoster
Re: How Can I replace Enter chars in a string
Hi ComputerJy,
Thanks. But I need to know what the enter chracter is.Will it be Chr(10) for example.
-
Aug 7th, 2008, 01:58 AM
#4
Re: How Can I replace Enter chars in a string
If its a typical text file then you can use string.replaceAll on the carriage return + line feed combination (use regex). try "\\n" first as the pattern.. if that doesn't work try "\\r" or "\\r\\n"
-
Aug 7th, 2008, 02:03 AM
#5
Re: How Can I replace Enter chars in a string
Code:
str.replace(System.getProperty("line.separator"), "NewLine");
Where str is a String instance, notice that the line.separator property differs between OSs (\n in unix & \r\n in windows).
You can also use the \n character directly
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 7th, 2008, 03:02 AM
#6
Thread Starter
PowerPoster
Re: How Can I replace Enter chars in a string
thanks a lot guys. That is exactly what I needed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|