• New Syntax Highlighter

    We have installed a new Syntax Highlighter on the forums, so we can highlight other languages then only PHP and HTML.

    The new Syntax Highlighter uses the standard [code] BB-Code with optionally the language specified by using the [code=language-code] syntax.

    Basic Usage

    If no language-code is specified the Syntax Highlighter will default to using Java. For some forums that deal with specific languages other then standard Java the default will be set to that specific language, for example the JavaFX forum will use "javafx" as default language.

    Examples:

    [code]public class HelloWorld {

    public static void main(String[] args) {
    System.out.println("Hello, World");
    }

    }[/code]
    Would result in:
    Java Code:
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    This would be the same as specifying "java" for the language code:

    [code=java]public class HelloWorld {

    public static void main(String[] args) {
    System.out.println("Hello, World");
    }

    }[/code]
    Would result in:
    Java Code:
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    Or using PHP as language:

    [code=php]<?php
    echo "Hello World.";
    ?>[/code]
    Would result in:
    PHP Code:
    <?php
    echo "Hello World.";
    ?>
    Advanced Usage

    Optionally you can also give the code block a title by following the language code with a semi-colon (;) and the Title text.

    Example:

    [code=java;This is the standard Hello World JAVA demo application]public class HelloWorld {

    public static void main(String[] args) {
    System.out.println("Hello, World");
    }

    }[/code]
    Would result in:
    Java Code: This is the standard Hello World JAVA demo application
    public class HelloWorld {
    
        public static void main(String[] args) {
            System.out.println("Hello, World");
        }
    
    }
    Copying text from a code block

    You can easily select all the text in a code block by double-clicking anywhere in the code block. In order to copy it to your clipboard, press Ctrl-C (Windows) or Command-C (Mac).

    Available Languages

    Currently the following language are available. They are listed together with their possible language-codes, use the language-code in the [code=language-code] BB-Codes.

    Brush Aliases
    AppleScript applescript
    ActionScript3 as3, actionscript3
    Bash bash, shell
    Cold Fusion cf, coldfusion
    C Sharp c-sharp, csharp
    C++ cpp, c
    CSS css
    Delphi delphi, pas, pascal
    Diff diff, patch
    Erlang erl, erlang
    Groovy groovy
    JavaScript js, jscript, javascript
    Java java
    Java FX jfx, javafx
    Perl perl, pl
    PHP php
    Plain Text plain, text
    Power Shell ps, powershell
    Python py, python
    Ruby On Rails ruby, rails, ror
    SASS sass
    Scala scala
    SQL sql
    Visual Basic vb, vbnet
    XML xml, xhtml, xslt, html

    Known limitations:

    In the current version a code block will not be syntax highlighted if you use the inline editor to edit a post. After a page refresh the code will show correctly.

    sunde887 and Arbalest like this.
    Comments 2 Comments
    1. eldony's Avatar
      eldony -
      Hi there,
      I am new to java language and to this forum as well.
      I don't know if this is the right place to post my question but I really need help.
      I am trying to print euro sign (€) in java using character primitive data type. I know how to display the symbol using the String data type but I am having headaches
      when it comes to using char.
      I have tried this

      public static void euro(){
      char num1 = 'u';
      char num2 = '2';
      char num3 = '0';
      char num4 = 'a';
      char num5 = 'c';



      System.out.println(num1 + num2 + num3 + num4 + num5);
      }
      but it displays 411 instead!!!

      Could anyone help.

      Regards. Eldony
    1. fahadmunir32's Avatar
      fahadmunir32 -
      I am a java beginner i am also sharing java codes on a blog i want to highlight my java codes on my blog.. Can any member can help
      Its My Blog Link..

      Java Objectshttp://java-programming-codes.blogspot.com