Java String to Hex convertStringToHexComma(String plain, boolean appendNullSigns)

Here you can find the source of convertStringToHexComma(String plain, boolean appendNullSigns)

Description

convert String To Hex Comma

License

LGPL

Declaration

public static String convertStringToHexComma(String plain, boolean appendNullSigns) 

Method Source Code

//package com.java2s;

public class Main {

    public static String convertStringToHexComma(String plain, boolean appendNullSigns) {
        if (plain == null || plain.trim().length() == 0)
            return plain;
        StringBuffer strBuf = new StringBuffer();
        for (int x = 0; x != plain.length(); x++) {
            if (x > 0)
                strBuf.append(",");
            strBuf.append(Integer.toHexString(plain.charAt(x)));
            if (appendNullSigns)
                strBuf.append(",00"); //this is needed, dunno why by the multi and expand string entries, but not for the binary
        }/* www .  j ava 2  s.  c om*/
        return strBuf.toString();
    }
}

Related

  1. convertStringToHex(String str)
  2. convertStringtoHexFormat(String stringToConvert)
  3. convertStringToHexString(String data)