Remove java comments from String ?

Hi All,
I assinged one java method source into a string .That java method having commented lines also.How to remove the commented lines from the string ?.
example:
String str;
str = "    public static boolean isIntNumber(String num)
        try
            Integer.parseInt(num); //checking for integer
        catch (NumberFormatException nfe)
            return false;
        return true;
    }";

That java method having commented lines also.How to remove the commented lines from the string ?.
not clear. with is above.
and how can u do like this.
str = public static boolean isIntNumber(String num)
i think it's ah pasting mistake. if so.
str = ? // here wht.
public static boolean isIntNumber(String num)
try
Integer.parseInt(num); //checking for integer
catch (NumberFormatException nfe)
return false;
return true;
am some what confused.
Edited by: Erp on Sep 29, 2011 5:58 AM

Similar Messages

  • [svn:bz-trunk] 21260: Update the qa-frameworks. zip to remove all comments from the base xml when merging config files.

    Revision: 21260
    Revision: 21260
    Author:   [email protected]
    Date:     2011-05-16 07:46:54 -0700 (Mon, 16 May 2011)
    Log Message:
    Update the qa-frameworks.zip to remove all comments from the base xml when merging config files.
    Modified Paths:
        blazeds/trunk/qa/resources/frameworks/qa-frameworks.zip

    Try options=('!makeflags') in PKGBUILD.

  • How to remove new line from string

    I have a string say following
    String line = "one\ntwo\nthree";Now i am trying to remove new line from string. For this i did following
    String txt = line.replaceAll("\\n","");But i see still new line is occuring. Is it correct way. Please advice me.

    Ok. I was just using \n instead of \r\n. And i am in windows. I will give a try with \r\n
    Ok i tried using following , but it doesnt work.
    line = line.replaceAll("\\r\n","");Am i missing anything here. Please guide me.
    Edited by: ArpanaK on Oct 8, 2007 4:44 PM

  • Removing HTML Comments from an entire website

    Hi, I wonder if there is a simpler way to remove 'HTML Comments' from an entire website without having to use the regular expression ' <!-- [\w\W]*?--> ' using Find & Replace in DW 8?  Many thanks, Simon

    Thanks Murray, - I guess I was hoping for a 'button' in DW 8 that offered this function without writing a simple regular expression that works just fine. What laziness!  My reasons for removing my HTML comments also puts me in a bad light!!!  Best wishes, Simon

  • How to remove the comma from string

    Hi,
    I Have string like below :
    String some1="123,44.22";
    I want to remove comma from string and final output should be 12244.22.
    public class getOut{
    public static void main(String args[]){
    String some1="123,44.22";
    getChars(int 0,some1.length(),char[] dst,0);
    can somebody in the forum give me idea how to remove comma from the String and
    have a string without comma.
    Thanks
    Jack

    int idx = oldString.indexOf(',');
    if(idx >= 0)   
          newString = oldString.substring(0, idx) + oldString.substring(idx + 1);or for jdk 1.4 and later
    str = str.replaceAll(",", "");

  • Removing Java 5 from my path

    I have an application that does not run correctly under Java 5 and that I start via the command line on Windows XP. I have both 1.4.2 installed as well as Java 5.
    I had my PATH and JAVA_HOME environment variables both pointing to Java 5 so I changed them to point to the 1.4.2 installation. Even after restarting the terminal and rebooting the machine itself, the java version in use is still Java 5.
    I then went to the java control panel that comes with Java 5 and changed whatever settings that were required to get 1.4.2 to be used instead of Java 5. It seems that this is mainly for applets but I gave it a try anyway. Still, the java version is Java 5 when I type 'java -version' on the command line.
    So, what am I missing?
    Richard

    If you remove that directory your computer will stop working.
    Those files are placed there by the last Java version installed on the assumption that you want that version as the default - that is, it's the version that will be executed when you type "java . . " without a path.
    You can either:
    Delete those Java files from the directory, in which case you will need to type the entire path to any of the java.exe, etc programs that you want executed. There will be no "default" version.
    Replace those files with files from a different version, copying them from the JDK bin directory, making that version the default.
    Uninstall all Java versions and then reinstall so that the last version installed is the one you want as the default.

  • Help removing encoded html from string

    Hello,
    I am trying to remove all html from a user input string.
    something like this:
    <cfset string ="sample text &lt;a&gt;">
    I have tried:
    Replace(string , "<[^>]*>", "", "ALL")
    Replace(string , "&lt;br &##x2f;&gt;>", "", "ALL")
    Neither remove the html, can anyone help?

    The related functions for replacing strings using regular expressions are REReplace and REReplaceNoCase. For example,
    <cfset string ="sample text <a>">
    <cfoutput>#REReplace(string , "<[^>]*>", "", "ALL")#</cfoutput>

  • How do I remove Java 8 from Yosemite?

    Hi
    I recently installed Java 8 in order to download a specific file.  I no longer need Java and wish to remove it.  I have followed some instructions on the Java website which told me to Trash the Java Applet Plugin - which I've done (even though it wasn't in the folder they said it would be in).  However, I still have a Java Preference Pane showing in Preferences which I can't delete.  When I right-click to remove, it asks for the Admin password and then returns a dialogue saying the item couldn't be deleted because an error occurred.
    Can anyone help with this one please?  I have found other suggestions which advise to remove a Java folder from the /Library/PreferencePanes/ folder but my PreferencePanes folder is empty.
    Thanks for any advice.
    Donna

    I've deleted both the plugin file and the plist file and rebooted.  But I still can't remove the Preference icon in the System Preferences.
    If you can help me get rid of this it would be great.
    Thanks
    Donna

  • Java update 2012-006 did not remove Java plugin from any browser

    I successfully installed Java update 2012-006 via Software Update on my iMac running OS X Lion 10.7.5 (German) and it updated the Java runtime to version 1.6.0_37 and removed the Java Preferences application as expected, but it did not remove the Java plugin from any browser!
    Safari and Firefox can still use the Java plugin as before.
    I repaired permissions, rebooted, manually downloaded Java update 2012-006 and successfully installed it again without any change to the Java plugin: it is still present on my system and fully functional from any browser!
    The web is full with messages from users missing the Java plugin after installing this update - but I could not find anything about the plugin not being removed!
    Is anyone experiencing the same behaviour under Lion? I thought this would happen only under Snow Leopard...
    What should I do now? Can I really trust this "successfull installation" of Java update 2012-006 on my system?
    Thanks,
    Michael

    Thanks - I will keep the symlink in place and I won't touch the Deploy bundle, because I need the plugin in Safari and I don't need Oracle's Java 7 for now...
    If the plugin is supposed to stay in the Deploy bundle, this could help others who miss the plugin - they could just recreate the symlink, right?
    To summarize I think we can state, that the Java update 2012-006 for Lion and Mountain Lion sometimes leaves the symlink in /Library/Internet Plugins/ untouched.
    The circumstances that lead to this behaviour are still unknown.
    The install log in Console shows that the scripts to create links and to delete obsolete files ran okay, but there was an error with the "postinstall" script. In spite of this the installation succeeded:
    Oct 20 16:24:52 michaels-imac Installer[284]: Java für OS X 2012-006  Installation Log
    Oct 20 16:25:56 michaels-imac _securityagent[305]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[307]: Begin script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[309]: End script: createlinks
    Oct 20 16:25:56 michaels-imac _securityagent[310]: Begin script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[314]: End script: deleteObsoleteFiles
    Oct 20 16:25:56 michaels-imac _securityagent[318]: Running Install Scripts . . .
    Oct 20 16:25:56 michaels-imac _securityagent[320]: Begin script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: com.apple.mrt.uiagent: Invalid argument
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt.uiagent
    Oct 20 16:25:56 michaels-imac installd[295]: postinstall: launchctl: Error unloading: com.apple.mrt
    Oct 20 16:25:56 michaels-imac _securityagent[334]: End script: postinstall.sh
    Oct 20 16:25:56 michaels-imac installd[295]: Installed "Java für OS X 2012-006" ()
    Oct 20 16:25:56 michaels-imac Installer[284]: Displaying 'Install Succeeded' UI.
    Does anybody know what "com.apple.mrt.uiagent" and "com.apple.mrt" stands for?
    Obviously the "postinstall" script provides an invalid argument (at least on my system).
    I have no idea if this is related to the Java Plugin symlink not being removed...

  • How to remove java icon from the frame and put own incon instead

    H Everybody
    Please tell me how can I remove standard java logo from JFrame and put my company's log instead
    Thanks in advance

    Hi,
    yourFrame.setIconImage((new ImageIcon("yours.gif")).getImage());Phil

  • How can I completely remove Java JRE from my system?

    Hi,
    the installation of an earlier version of JRE didn't finish properly (1.5.??), since then it isn't possible at all neither to deinstall it nor to install ANY version (stops on extraction of the installation files, the process must be killed by the task manager!). It seems as if there are some incorrect statements left in the registry.
    When I try to install the latest version, it stops with a "missing version information" error.
    Is there any possibility to remove ALL statements belonging to Java out of the registry without doing it manually, so that I can install the latest version? Or does anyone of you have a better idea?
    THX,
    Christian
    Edited by: ChrizzLee on Oct 22, 2007 12:32 PM

    If the uninstaller has already lost some files, it will be diffcult to uninstall properly from Add/remove programs. Its better to remove the entry from registry.Actually you can do it safe without much problem.If no other versions of java are installed, delete the javasoft key (entire tree)from LOCAL_MACHINE\SOFTWARE. Then reinstall jdk.It should splve the problem

  • How to remove default comment from XML output

    Hi,
    I have a requirement to generate the XML report with XML output(Not PDF). Everything is working fine except I am getting one comment line "<!--Generated by Oracle Reports version 6.0.8.28.0--> which is not required and I want to remove this line. This report will be run through Oracle Apps 11i.
    Thanks.

    Hi,
    There is option to change the "Prolog Value" but nothing is there to remove the comment.
    Thanks

  • Removing \r\n from string

    Hello, how do I remove the "\r\n" newline characters from a
    string in AS3 ?
    I can do it in Flex using StringUtil trim, but that is not
    available in Flash.
    Thanks for any help.

    Try something like this which replaces returns with a space:
    //grep to globally (gi) look for returns
    var returns:RegExp=/\r/gi;
    //your input text
    var str:String="the text";
    //return the clean text
    str.replace(returns," ");

  • Remove leading zeros from string

    I am working on a report and I am having a little issue with the output.
    I have several dollar amount fields that I need to format with only the decimal place. The amount fields are coming in as strings between 10-16 characters.
    I could not find a way to use the currency formatter so I used substrings to break it apart and put it back together in the format I need. However I am now running into an issue with leading zeros. I can't used ReplaceAll as there is a possibility of having a 0 in the amount field.
    Here is what I have done for the substrings:
    int intLength = strField.length();
    intDollar = intLength - 2;          
    strDollar = strField.substring(1, intDollar);
    strCent = strField.substring(intDollar, intLength);
    System.out.println(strDollar + "." + strCent);The original string: 0000000037049469
    My output now: 00000000370494.69
    Desired output: 37049469
    Any suggestions on how to remove the leading zeros?
    Edited by: xxwhocaresxx on Jun 10, 2009 12:11 PM

    804350 wrote:
    Just wanted to comment that I solved the issue differently by casting the string value to an integer and back. Don't know if it's bad solution performancewiseNever, ever, ever, ever, ever, ever, ever worry about performance. At least not until you're much further along the road; and even then not until you've proved that it's inadequate.
    but it's quite compact and readable and did the job of eliminating leading zeros.I suspect you'll also find that it has the great advantage of providing you with a dollar (or cent) value that you can use elsewhere in your program the way it was intended.
    example:
    String noZeros = String.valueOf(Integer.parseInt(stringWithZeros));Or possibly even more usefully:
    int cents = Integer.parseInt(stringWithZeros);
    String noZeros = String.valueOf(cents);I'd also suggest looking up the NumberFormat and DecimalFormat classes, and PrintStream.printf(); all very useful for what you're trying to do.
    Winston

  • Remove HTML tags from String

    it sounded prettty easy..
    I know the first part of my String is <html><center><p> and the last part is </p></center></html>
    but for saving it into the database I want to remove the HTML parts..
    I know how much characters the html stuff is.. I know what the html is.. how do I remove it from my string?

    If your String always starts with <html><center> and always ends with </center></html> you can use:
         int startLength = "<html><center>".length();
         int endLength = "</center></html>".length();
         String withoutHtml = myString.substring(startLength, myString.length() - endLength);

Maybe you are looking for

  • Image size differences in libraries

    I just upgraded to iphoto 6.0.6 Now when I am looking at my pictures some are full screen and some are about the size of a playing card or letter envelope. Under general preferences I have selected "using full screen". This was not problem prior to t

  • Issue with brand new iPod Nano 7g No Phone, can't contact Apple

    Hi everyone, I just got my brand new iPod Nano the other day, when I opened it up and took the sticker off, I saw a large scratch down the screen. That was annoying enough but the scratch affects the touchscreen ability and it's very tough to ignore.

  • I have been sent a AI file but i cant change the text, i am new to AI please help it is driving me mad

    I have been send a AI file but cant select the text to change it, I am new too AI. If i type i can save and change but not on a file i have been sent, using pc wil AI cc CHEERS

  • Upgrade error

    Last login: Sat Nov 11 02:38:21 on ttyp1 /Applications/iTunes.app/Contents/MacOS/iTunes; exit Welcome to Darwin! laptop:~ LoginID$ /Applications/iTunes.app/Contents/MacOS/iTunes; exit iTunes(571,0xa000cf80) malloc: * vm_allocate(size=4294942720) fail

  • Applied Transaction Table for A/R Invoice

    Hi All, I am using SBO 8.8 PL15 i want the information of Applied Transaction against A/R Invoice. In Which table SBO stores information of Applied Transaction Regards, Bhavank