EOL: String related exceptions [message #1736838] |
Sat, 02 July 2016 11:40  |
Eclipse User |
|
|
|
Hi,
I have a string comment s with the following value:
/*
* comment line 1
* comment line 2
* comment line 3
*/
I want to remove the '/*' and '*' from this string. When I use the following statement to remove '*' from the s string:
s.replace("*","").println();
I get the following exception error:
Internal error: java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
Finally, I would like to display the string on the console view without any '/*' and '*'. Of course, it seems that copying the string (character by character, except '/*' and '*') can be a solution here. However, I cannot implement this approach as well! Since the string copy loop as following,
var t: String;
var i: Integer = 0;
while (i < s.length())
{
if (s.charAt(i) <> "*" and s.charAt(i) <> "/") // it's always 'true'
{
t.println();
t = t + s.charAt(i);
}
i = i + 1;
}
t.println();
is not working as I expect!
Is there any trick to solve this problem?
Best regards,
Alireza
[Updated on: Mon, 04 July 2016 03:28] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.44791 seconds